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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
rizwanreza
November 13, 2014
34
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
The Ember.js Run Loop
rizwanreza
November 13, 2014
Transcript
30 slides
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
More Decks by rizwanreza
See All by rizwanreza
Database Integrity in Rails
rizwanreza
1
120
Featured
See All Featured
We Are The Robots
honzajavorek
0
460
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
390
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
470
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
1k
HDC tutorial
michielstock
2
1k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5.9k
A Modern Web Designer's Workflow
chriscoyier
699
190k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
7.1k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
1
250
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
2
6.5k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
550
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
320