I’m trying to wrap my head around the meaning and best practice of
Ember.run. The docs are useful in showing some ways to take advantage of the
Ember.run.* helper methods, but I find it lacks information on the most basic usage of
I floated a stack overflow question about this which has not attracted interest: http://stackoverflow.com/questions/19217287/why-should-i-use-ember-run-when-handling-events-in-other-libraries
My understanding of
Ember.run is that it immediately runs the callback supplied to it, and then runs the RunLoop algorithm of flushing all the queues.
I’m trying to understand why you’d ever need to manually ensure the synchronization of bindings and firing of subsequent events. In my example, I’m handling a jQuery UI event by sending an action to a controller. As far as I can tell, wrapping this
send within a call to
Ember.run has no effect.
Within unit and integration tests, I have come across some cases where using
Ember.run is helpful, namely when you expect things to happen immediately that would otherwise be deferred, such as appending a view to the DOM.
There must be some use cases for
Ember.run that escape me. Could you folks shed some light on this topic?