We have a component which extends Ember TextField
TextField.extend({ /* After user changes value manually */ change: function (event) { this.set('data', this.parse(this.get('value'))); // We call sync here to ensure that any properties depending on this new data // have settled before we fire the change action (which may rely on the values). Ember.run.sync(); this.sendAction('on-change', event, this.item); }, });
We call Ember.run.sync()
before sending out on-change
event to make sure all dependency properties are set.
But in Ember 3.2.2, there is no Ember.run.sync
Can I rewrite the component like this:
TextField.extend({ /* After user changes value manually */ change: function (event) { this.set('data', this.parse(this.get('value'))); Ember.run.next(this, function() { this.sendAction('on-change', event, this.item); }); }, });
Would that have the same “effect” as run.sync() ?