I am working through the Ember Guides and am reading about observers. They note that
Observers in Ember are currently synchronous. This means that they will fire as soon as one of the properties they observe changes.
And give the example that
Person.reopen({
lastNameChanged: function() {
// The observer depends on lastName and so does fullName. Because observers
// are synchronous, when this function is called the value of fullName is
// not updated yet so this will log the old value of fullName
console.log(this.get('fullName'));
}.observes('lastName')
});
Yet when I try out this code it returns the new 'fullName'.
Why is this happening?
Aucun commentaire:
Enregistrer un commentaire