Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
The Ember.js Run Loop
Search
rizwanreza
November 13, 2014
32
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
The Ember.js Run Loop
rizwanreza
November 13, 2014
More Decks by rizwanreza
See All by rizwanreza
Database Integrity in Rails
rizwanreza
1
100
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
600
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
850
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The Spectacular Lies of Maps
axbom
PRO
1
1.1k
Making Projects Easy
brettharned
120
6.8k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8.1k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3.1k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
730
Claude Code のすすめ
schroneko
67
230k
Transcript
The Ember.js Run Loop
Coalescing Modularity Performance
“the run loop is a mechanism that Ember.js uses to
group, coordinate, and execute events, key-value notifications, and timers within your application.” From Ember.js in Action
Queues in the Run Loop Sync Actions Render AfterRender Destroy
Ember implements listeners for each of these queues Sync Actions
Render AfterRender Destroy
QUEUE ! ! ! ! ! ! UPDATE EVENTS PREVIOUS
QUEUE NEXT QUEUE Run Loop
Processing each queue can emit events to the proceeding/ preceding
queues
It’s not an infinite loop
Sync Queue: Propagates bound data Sync Actions Render AfterRender Destroy
Actions Queue: Runs Promises Runs Initialization Events Sync Actions Render
AfterRender Destroy
All custom events go to the Actions queue Sync Actions
Render AfterRender Destroy
Render Actions Sync AfterRender Destroy Render Queue: Manipulates DOM Re-renders
views
AfterRender Queue: Handles extra DOM events Actions Sync Destroy AfterRender
Render
Actions Sync Destroy AfterRender Render AfterRender queue is a good
place to initialize jQuery plugins on elements added by the Render queue
Destroy Queue: Garbage-collects views Actions Sync AfterRender Destroy Render
Sync Actions Render AfterRender Destroy
Sync Actions Render AfterRender Destroy {3 isCompleted Events 3 checked
events 3 remainingFormatted 3 markAllDone updates
{3 checkboxes 1 change to status 1 change to “Mark
all as done” Render Actions Sync AfterRender Destroy
Executing code in the Ember Run Loop
$.post(‘/post_cc’, success: function(e) { Ember.run(function() { this.store.createRecord('user', { cardId: e.data.customerId,
planId: 'pro' }); }); }); Executes code immediately by reusing/starting run loop
Ember.run.next(function () { this.set(‘flash’, “Hello world”); }) Executes code in
the next available run loop
Ember.run.later(function () { this.set(‘flash’, “Hello world”); }, 1000) Executes code
in the next available run loop after 1s
Ember.run.schedule('afterRender', this, function () { this.$().tooltip(); }); Schedules in the
“afterRender” queue
Schedules once in the “afterRender” queue Ember.run.scheduleOnce('afterRender', this, function ()
{ this.$().tooltip(); });
Resources
None
None
https://github.com/eoinkelly/ ember-runloop-handbook Ember runloop handbook
Q&A
Thanks! @rizwanreza