I've been working on the Todo MVC App for Ember. In the model, I noticed a call to a commit() method wrapped in Ember.run.once
See: https://github.com/addyosmani/todomvc/blob/gh-pages/architecture-examples/emberjs/js/models/todo.js#L9
todoDidChange: function () {
Ember.run.once(this, function () {
this.get('store').commit();
});
}.observes('isCompleted', 'title');
How does wrapping this.get('store').commit()
in Ember.run.once
help? I changed the method to just do:
todoDidChange: function () {
this.get('store').commit();
}.observes('isCompleted', 'title');
But I dont see any visible difference. I read the documentation and a previos SO discussion haven't been able to figure it out.
Is this a case where the difference doesn't show because it's just a small app?