The run loop in Ember starts off with three 'default' queues (sync
, actions
, destroy
) setup here. A few additional queues (render
and afterRender
) are added by the ember-views
package here. The ember-routing
package also adds routerTransitions
here.
You can see the list of run loop queues in your application along with their ordering by running Ember.run.queues
in the console:
Ember.run.queues
["sync", "actions", "routerTransitions", "render", "afterRender", "destroy"]
Here is a little more detail about each queue (along with source references if available/known):
sync
- Bindings use this queue so this method is a useful way to immediately force all bindings in the application to sync. Use this queue anytime you need any changed state to propagate throughout the app immediately without repainting the UI (which happens in the later 'render' queue added by theember-views
package). (See here for details.)actions
- This is the default queue and is used the most throughout the Ember codebase.- Used for
Ember.run
andEmber.run.later
by default. - RSVP promises resolve in this queue.
- Used for
routerTransitions
- Used in router transitions to prevent unnecessary loading state if all promises resolve on theactions
queue first. (See here.)render
- Used for rendering views after bindings have synced. All DOM element operations happen in this queue.afterRender
- Used for scheduling actions that occur after all view rendering (DOM operations) has occurred.destroy
- Used byEmber.Core.Object
within thedestroy
function (see here) to schedule destruction to happen at the end of the run loop.