Submit Search
Upload
Beyond DOM Manipulations: Building Stateful Modules with Events and Promises
•
0 likes
•
6,346 views
Crashlytics
Follow
Presented at jQuery Conf Portland 2013
Read less
Read more
Technology
Slideshow view
Report
Share
Slideshow view
Report
Share
1 of 53
Download now
Download to read offline
Recommended
New Perspectives on Performance
New Perspectives on Performance
mennovanslooten
SproutCore is Awesome - HTML5 Summer DevFest
SproutCore is Awesome - HTML5 Summer DevFest
tomdale
Angular js vs. Facebook react
Angular js vs. Facebook react
Keyup
Intro to jQuery
Intro to jQuery
Ralph Whitbeck
Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1
Ralph Whitbeck
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Pablo Godel
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009
Ralph Whitbeck
A journey beyond the page object pattern
A journey beyond the page object pattern
RiverGlide
Recommended
New Perspectives on Performance
New Perspectives on Performance
mennovanslooten
SproutCore is Awesome - HTML5 Summer DevFest
SproutCore is Awesome - HTML5 Summer DevFest
tomdale
Angular js vs. Facebook react
Angular js vs. Facebook react
Keyup
Intro to jQuery
Intro to jQuery
Ralph Whitbeck
Intro to jQuery - LUGOR - Part 1
Intro to jQuery - LUGOR - Part 1
Ralph Whitbeck
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Pablo Godel
jQuery For Beginners - jQuery Conference 2009
jQuery For Beginners - jQuery Conference 2009
Ralph Whitbeck
A journey beyond the page object pattern
A journey beyond the page object pattern
RiverGlide
jQuery Conference Chicago - September 2014
jQuery Conference Chicago - September 2014
dmethvin
jQuery Conference San Diego 2014 - Web Performance
jQuery Conference San Diego 2014 - Web Performance
dmethvin
Rapid Testing, Rapid Development
Rapid Testing, Rapid Development
mennovanslooten
AngularJS best-practices
AngularJS best-practices
Henry Tao
Velocity EU 2014 — Offline-first web apps
Velocity EU 2014 — Offline-first web apps
andrewsmatt
Deep dive into AngularJs for Beginners
Deep dive into AngularJs for Beginners
Vassilis Pitsounis
J!Layout Overrides Einstieg und Beispiele
J!Layout Overrides Einstieg und Beispiele
Niels Nübel
Backbone/Marionette introduction
Backbone/Marionette introduction
matt-briggs
Hybrid Web Applications
Hybrid Web Applications
James Da Costa
Introduction to Jquery
Introduction to Jquery
Amzad Hossain
Fronted From Scratch - Supercharge Magento page speed
Fronted From Scratch - Supercharge Magento page speed
Yousef Cisco
Making your Angular.js Application accessible
Making your Angular.js Application accessible
Dirk Ginader
Web view
Web view
Sourabh Sahu
A Debugging Adventure: Journey through Ember.js Glue
A Debugging Adventure: Journey through Ember.js Glue
Mike North
Accessibility - A feature you can build
Accessibility - A feature you can build
Monika Piotrowicz
Javascript done right - Open Web Camp III
Javascript done right - Open Web Camp III
Dirk Ginader
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Masashi Shibata
AngularJS for Java Developers
AngularJS for Java Developers
Loc Nguyen
Taking your Web App for a walk
Taking your Web App for a walk
Jens-Christian Fischer
5 Tips for Writing Better JavaScript
5 Tips for Writing Better JavaScript
Nael El Shawwa
Architecture patterns and practices
Architecture patterns and practices
Fuqiang Wang
Operationalizing Clojure Confidently
Operationalizing Clojure Confidently
Prasanna Gautam
More Related Content
What's hot
jQuery Conference Chicago - September 2014
jQuery Conference Chicago - September 2014
dmethvin
jQuery Conference San Diego 2014 - Web Performance
jQuery Conference San Diego 2014 - Web Performance
dmethvin
Rapid Testing, Rapid Development
Rapid Testing, Rapid Development
mennovanslooten
AngularJS best-practices
AngularJS best-practices
Henry Tao
Velocity EU 2014 — Offline-first web apps
Velocity EU 2014 — Offline-first web apps
andrewsmatt
Deep dive into AngularJs for Beginners
Deep dive into AngularJs for Beginners
Vassilis Pitsounis
J!Layout Overrides Einstieg und Beispiele
J!Layout Overrides Einstieg und Beispiele
Niels Nübel
Backbone/Marionette introduction
Backbone/Marionette introduction
matt-briggs
Hybrid Web Applications
Hybrid Web Applications
James Da Costa
Introduction to Jquery
Introduction to Jquery
Amzad Hossain
Fronted From Scratch - Supercharge Magento page speed
Fronted From Scratch - Supercharge Magento page speed
Yousef Cisco
Making your Angular.js Application accessible
Making your Angular.js Application accessible
Dirk Ginader
Web view
Web view
Sourabh Sahu
A Debugging Adventure: Journey through Ember.js Glue
A Debugging Adventure: Journey through Ember.js Glue
Mike North
Accessibility - A feature you can build
Accessibility - A feature you can build
Monika Piotrowicz
Javascript done right - Open Web Camp III
Javascript done right - Open Web Camp III
Dirk Ginader
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Masashi Shibata
AngularJS for Java Developers
AngularJS for Java Developers
Loc Nguyen
Taking your Web App for a walk
Taking your Web App for a walk
Jens-Christian Fischer
5 Tips for Writing Better JavaScript
5 Tips for Writing Better JavaScript
Nael El Shawwa
What's hot
(20)
jQuery Conference Chicago - September 2014
jQuery Conference Chicago - September 2014
jQuery Conference San Diego 2014 - Web Performance
jQuery Conference San Diego 2014 - Web Performance
Rapid Testing, Rapid Development
Rapid Testing, Rapid Development
AngularJS best-practices
AngularJS best-practices
Velocity EU 2014 — Offline-first web apps
Velocity EU 2014 — Offline-first web apps
Deep dive into AngularJs for Beginners
Deep dive into AngularJs for Beginners
J!Layout Overrides Einstieg und Beispiele
J!Layout Overrides Einstieg und Beispiele
Backbone/Marionette introduction
Backbone/Marionette introduction
Hybrid Web Applications
Hybrid Web Applications
Introduction to Jquery
Introduction to Jquery
Fronted From Scratch - Supercharge Magento page speed
Fronted From Scratch - Supercharge Magento page speed
Making your Angular.js Application accessible
Making your Angular.js Application accessible
Web view
Web view
A Debugging Adventure: Journey through Ember.js Glue
A Debugging Adventure: Journey through Ember.js Glue
Accessibility - A feature you can build
Accessibility - A feature you can build
Javascript done right - Open Web Camp III
Javascript done right - Open Web Camp III
Djangoアプリのデプロイに関するプラクティス / Deploy django application
Djangoアプリのデプロイに関するプラクティス / Deploy django application
AngularJS for Java Developers
AngularJS for Java Developers
Taking your Web App for a walk
Taking your Web App for a walk
5 Tips for Writing Better JavaScript
5 Tips for Writing Better JavaScript
Similar to Beyond DOM Manipulations: Building Stateful Modules with Events and Promises
Architecture patterns and practices
Architecture patterns and practices
Fuqiang Wang
Operationalizing Clojure Confidently
Operationalizing Clojure Confidently
Prasanna Gautam
Design Patterns for Mobile Applications
Design Patterns for Mobile Applications
C4Media
Writing SaltStack Modules - OpenWest 2013
Writing SaltStack Modules - OpenWest 2013
SaltStack
Android WebView, The Fifth Element
Android WebView, The Fifth Element
Murat Yener
Troubleshooting Live Java Web Applications
Troubleshooting Live Java Web Applications
ashleypuls
RequireJS
RequireJS
Sebastiano Armeli
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
Jeremy Kendall
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
elliando dias
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
Cyrille Le Clerc
Advanced App Building - Tips, Tricks & Lessons Learned
Advanced App Building - Tips, Tricks & Lessons Learned
Jay Graves
Complex Architectures in Ember
Complex Architectures in Ember
Matthew Beale
Building a Startup Stack with AngularJS
Building a Startup Stack with AngularJS
FITC
Pushing The Boundaries Of Continuous Integration
Pushing The Boundaries Of Continuous Integration
Robbie Clutton
ui-router and $state
ui-router and $state
garbles
Angular from Scratch
Angular from Scratch
Christian Lilley
JavaScript Dependencies, Modules & Browserify
JavaScript Dependencies, Modules & Browserify
Johan Nilsson
Automated release management with team city & octopusdeploy - NDC 2013
Automated release management with team city & octopusdeploy - NDC 2013
Kristoffer Deinoff
The InstallShield of the 21st Century – Theo Schlossnagle
The InstallShield of the 21st Century – Theo Schlossnagle
Chef Software, Inc.
Generic Setup De-Mystified
Generic Setup De-Mystified
Clayton Parker
Similar to Beyond DOM Manipulations: Building Stateful Modules with Events and Promises
(20)
Architecture patterns and practices
Architecture patterns and practices
Operationalizing Clojure Confidently
Operationalizing Clojure Confidently
Design Patterns for Mobile Applications
Design Patterns for Mobile Applications
Writing SaltStack Modules - OpenWest 2013
Writing SaltStack Modules - OpenWest 2013
Android WebView, The Fifth Element
Android WebView, The Fifth Element
Troubleshooting Live Java Web Applications
Troubleshooting Live Java Web Applications
RequireJS
RequireJS
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
Step by Step Guide for building a simple Struts Application
Step by Step Guide for building a simple Struts Application
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
Open Source Monitoring for Java with JMX and Graphite (GeeCON 2013)
Advanced App Building - Tips, Tricks & Lessons Learned
Advanced App Building - Tips, Tricks & Lessons Learned
Complex Architectures in Ember
Complex Architectures in Ember
Building a Startup Stack with AngularJS
Building a Startup Stack with AngularJS
Pushing The Boundaries Of Continuous Integration
Pushing The Boundaries Of Continuous Integration
ui-router and $state
ui-router and $state
Angular from Scratch
Angular from Scratch
JavaScript Dependencies, Modules & Browserify
JavaScript Dependencies, Modules & Browserify
Automated release management with team city & octopusdeploy - NDC 2013
Automated release management with team city & octopusdeploy - NDC 2013
The InstallShield of the 21st Century – Theo Schlossnagle
The InstallShield of the 21st Century – Theo Schlossnagle
Generic Setup De-Mystified
Generic Setup De-Mystified
Recently uploaded
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
Pixlogix Infotech
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
Rizwan Syed
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
Fwdays
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
Curtis Poe
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
UiPathCommunity
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
Scott Keck-Warren
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
Mattias Andersson
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
Dubai Multi Commodity Centre
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
2toLead Limited
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
Dilum Bandara
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
LoriGlavin3
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
Lorenzo Miniero
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
Fwdays
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
comworks
How to write a Business Continuity Plan
How to write a Business Continuity Plan
Databarracks
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
Manik S Magar
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
DianaGray10
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
Alex Barbosa Coqueiro
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
hariprasad279825
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
Slibray Presentation
Recently uploaded
(20)
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
How to write a Business Continuity Plan
How to write a Business Continuity Plan
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
Beyond DOM Manipulations: Building Stateful Modules with Events and Promises
1.
Building Stateful Modules
with Events and Promises DOMManipulation patrickCAMACHO Beyond Friday, June 14, 13
2.
CrashlyticsforAndroid&iOS Friday, June 14,
13
3.
Friday, June 14,
13
4.
Friday, June 14,
13
5.
Friday, June 14,
13
6.
Friday, June 14,
13
7.
Railsto Backbone. Friday, June
14, 13
8.
Whatdidwehave? Model Backbone.Model Backbone.Collection Routing Backbone.Router, Backbone.History Views Backbone.Views Events Backbone.Events MV* components Friday, June
14, 13
9.
What’smissing? Friday, June 14,
13
10.
TransitioningPagestoStates. Friday, June 14,
13
11.
Piecemeal. App State Friday, June 14,
13
12.
Piecemeal. App Router State Friday, June 14,
13
13.
Piecemeal. App Router Directors State Friday, June
14, 13
14.
Piecemeal. App Router Directors State Friday, June
14, 13
15.
Addingamodal. Friday, June 14,
13
16.
Friday, June 14,
13
17.
Neededbetterstructure. • Builtonsingleflowand states • Modaldidn’tfitflow •
Backtothe drawingboard App Router Directors State Friday, June 14, 13
18.
Neededbetterstructure. • Builtonsingleflowand states • Modaldidn’tfitflow •
Backtothe drawingboard App Router Directors State Settings Friday, June 14, 13
19.
Thebirthofthe“module”. • Entirelyindependentpiecesoffunctionality • Itcouldaccepteventsandstart/stopitself State this.$('.settings').click(function(){ CLS.Components.Settings.trigger('start'); }); Settings this.$('.overlay').click((function(){ this.trigger('stop'); }).bind(this)); Friday,
June 14, 13
20.
Asyncbehavior. Friday, June 14,
13
21.
Asyncbehaviorinstates. • Fetchingdata,animations,etc • Wanttoshutanythingdownwhenstopping Settings Server (rendering) Friday,
June 14, 13
22.
Promises. • $.Promisesand$.Deferreds • .done,.fail,.always •
.resolve,.reject fetch1 = $.get('data.json'); fetch2 = $.get('data2.json'); fetch1.done(function(){ console.log(‘success!’); } fetch2.always(function(){ console.log(‘complete!’); } $.when(fetch1, fetch2).fail(function(){ console.log(‘fail!’); }); Friday, June 14, 13
23.
UsingwithComponents. Settings.start = function()
{ this.stopDeferred = $.Deferred(); fetch1 = $.get('data.json'); this.stopDeferred.done(fetch1.abort); fetch2 = $.get('data2.json'); this.stopDeferred.done(fetch2.abort); $.when(fetch1, fetch2).done(this.render.bind(this)); } Settings.stop = function() { this.stopDeferred.resolve(); } Friday, June 14, 13
24.
Goodintheshortrun. • Onlyhadoneapplication • Componentslived forever •
Singletonshidthe problems Settings Alert Center RealTime Analytics Friday, June 14, 13
25.
Multipleapplications. Friday, June 14,
13
26.
Distinctfunctionality. Friday, June 14,
13
27.
Distinctfunctionality. Friday, June 14,
13
28.
Multipleapplications. • Lostcoreassumptionofapage-longapp • Appsbegantolookmoreandmorelikemodules Onboarding Onboarding.start
: function(){ if(this._isActive) return; ... this._isActive = true; } Onboarding.stop : function(){ if(!this._isActive) return; ... this._isActive = false; } Friday, June 14, 13
29.
Multipleapplications. Apps Router Directors State Friday, June
14, 13
30.
Persistentfunctionalty. • Componentsneededtobestarted/stoppedbyappson start/stop • Notallshouldbestartedorstopped •
Backtoheavyconditionals if(nextApp === 'onboard') { CLS.Components.Settings.trigger('stop'); CLS.Components.AlertCenter.trigger('stop'); } else if(nextApp === 'logout') { CLS.Components.Settings.trigger('stop'); CLS.Components.AlertCenter.trigger('stop'); CLS.Components.RealTime.trigger('stop'); } else if... Friday, June 14, 13
31.
Findingapattern. Friday, June 14,
13
32.
Sameproblem,differentlevels. • Eventing • Start •
Stop • Dependencies App State State Component Component Component Friday, June 14, 13
33.
Isolatingknowledge. Friday, June 14,
13
34.
Toomanydirectreferences. • Don’tknowoutsideinformation • Clearestinstoppingdependencies if(nextApp
=== 'onboard') { CLS.Components.Settings.trigger('stop'); CLS.Components.AlertCenter.trigger('stop'); } else if(nextApp === 'logout') { CLS.Components.Settings.trigger('stop'); CLS.Components.AlertCenter.trigger('stop'); CLS.Components.RealTime.trigger('stop'); } else if... Friday, June 14, 13
35.
Eventingwitharguments. Onboarding Dashboard Dashboard.start =
function() { Onboarding.trigger('stop', this.dependencies); } Onboarding.stop = function(dependencies) { if(dependencies == null) { dependencies = [] } this.dependencies.forEach(function(dependencies){ if(dependencies.indexOf(dependency) < 0) { dependency.trigger('stop', dependencies); } }); } Friday, June 14, 13
36.
• Wantedevents,butnottheknowledge Stilltightlycoupled. Dashboard.start =
function() { Onboarding.trigger('stop', this.dependencies); LoggedOut.trigger('stop', this.dependencies); } Friday, June 14, 13
37.
Simplifyfunctionality. Friday, June 14,
13
38.
Usingavent. • Allofthesepiecesareusingevents • Isolatethatfunctionalitytoasingleunit Vent Vent
= function() {...} Vent.prototype.on = function() {...} Vent.prototype.one = function() {...} Vent.prototype.off = function() {...} Vent.prototype.trigger = function() {...} Friday, June 14, 13
39.
Sharingavent. OnboardingDashboard Vent Onboarding.start =
function() { this.vent.trigger('app:dashboard:stop', this.dependencies); this.vent.trigger('app:loggedOut:stop', this.dependencies); } Friday, June 14, 13
40.
Smartsubscriptions. Dashboard.start = function(vent)
{ this.vent.trigger('app:onBeforeStart', this.dependencies); this.vent.one('app:onBeforeStart', this.stop.bind(this)); } Onboarding.start = function(vent) { this.vent.trigger('app:onBeforeStart', this.dependencies); this.vent.one('app:onBeforeStart', this.stop.bind(this)); } OnboardingDashboard Vent Friday, June 14, 13
41.
Sharinginformation. Friday, June 14,
13
42.
• Sharedatabetweenmodules • Useventtoregisterresponsesandrequest Synchronousdatareturns. VentDashboard
Settings Friday, June 14, 13
43.
Dashboard.start = function()
{ this.currentApplication = ‘foo bar’ this.vent.setResponse( 'current_application', (function(){ return this.currentApplication; }).bind(this); ); } Settings.start = function() { app = this.vent.requestResponse('current_application'); } Synchronousdatareturns. Friday, June 14, 13
44.
Tyingitalltogether. Friday, June 14,
13
45.
Modularizeallthethings! • Isolatedfunctionality • Start/stop •
Managingdependencies • Eventing • Asyncbehavior Friday, June 14, 13
46.
Modularizeallthethings! Component App State • Isolatedfunctionality • Start/stop •
Managingdependencies • Eventing • Asyncbehavior Friday, June 14, 13
47.
Vent Rethinkingtheflow. Friday, June 14,
13
48.
Vent Rethinkingtheflow. Router Friday, June 14,
13
49.
ComponentsVent Rethinkingtheflow. Apps Router Friday, June 14,
13
50.
Vent ComponentsVent Rethinkingtheflow. Apps Router States Friday, June 14,
13
51.
Vent Vent ComponentsVent Rethinkingtheflow. Apps Router States States Friday, June 14,
13
52.
Makingityours • Managecomplexityandscale • Isolatefunctionalityintomodules •
Managedependencies • Allowmodulestocommunicatethroughavent Friday, June 14, 13
53.
YOUpatrickCAMACHO Thank try.crashlytics.com/jobs Friday, June 14,
13
Download now