These are chat archives for ractivejs/ractive

2nd
Jul 2018
Shakeel Osmani
@shakeelosmani
Jul 02 2018 15:44

Another quick question guys, Suppose I have a property like this:

data: {
  candyTypes: {
    sweet:'',
    sour:'',
    sweetandsour:''
  }
}

Now I want to have a observe function inside which I want to track the changes made to a particular candy type:

observe: {
 candyTypes.sweet:function(value){
    console.log('Sweet candy is now: ' +value);
 }
}

What's the correct way to write this syntax?

Joseph
@fskreuz
Jul 02 2018 15:56
Off the top of my head:
observe: {
 'candyTypes.sweet': function(value){
    console.log('Sweet candy is now: ' +value);
 }
}
Shakeel Osmani
@shakeelosmani
Jul 02 2018 16:00

Off the top of my head:

observe: {
 'candyTypes.sweet': function(value){
    console.log('Sweet candy is now: ' +value);
 }
}

Thanks @fskreuz , that is correct.