vendredi 8 mai 2015

How to update Ember debounce context

Ember.run.debounce does not update context when calling the debounce functionality multiple times within the specified period:

var changeName = function() {
console.log(this.get('name'));
// always outputs 'An' for this.get('name')
};

this.set('name', 'An');

Ember.run.debounce(this, changeName, 100, true);

// 50 ms passed.
this.set('name', 'peter');
Ember.run.debounce(this, changeName, 100, true);

Is there a Ember way/alternative to implement debounce functionality while updating context?

Aucun commentaire:

Enregistrer un commentaire