Quantcast
Viewing all articles
Browse latest Browse all 4828

Observer with params to know the new value of the observed property

@fguillen wrote:

I have found the situation that I am observing a property change but I also want to know, into the Observer, what has been the change.

I have the intuition that once one Observer is triggered the property the Observer is observing may have changed its value already.. maybe for another previously executed Observer.

So my question/suggestion is having the possibility of knowing the new value set to the observed property that has triggered the Observer:

onPropertyChanges: Ember.observer('property1', 'property2', function(changesOnProperties){
  let oldValueOnProperty1 = changesOnProperties.property1.oldValue;
  let newValueOnProperty1 = changesOnProperties.property1.newValue;

  ...
})

Posts: 7

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles