SlideShare une entreprise Scribd logo
1  sur  30
Télécharger pour lire hors ligne
SOPHISTICATED
VIEWS
How Ember's View Layer Handles the
Complex Problems
ME
PETER WAGENET
■ Tilde Employee
■ Ember Core Team Member
■ Former SproutCore Core Team Member
■ Ruby on Rails Developer
EMBER
A FRAMEWORK FOR
CREATING AMBITIOUS
WEB APPLICATIONS

            How many here are familiar with Ember?
            What do you all use?
A BRIEF HISTORY
WHY EMBER?
There’s a myriad of      ■ No trivial choices
JavaScript application
                         ■ Write less code
frameworks. Here are
some reasons to pick     ■ We solve the complex
Ember.                     problems
                                       I’d rather sell you on philosophy than
                                       features. It’s more important for you to
                                       know how we approach problems.
THE
COMPLEX
PROBLEMS
SOME PROBLEMS
There are a number of    ■ Managing Nested Views
complex problems that
                         ■ Handling Events
Ember tackles. We’ll
focus on two of them            Event handling is in some ways a subset of
                                nested views, but is a large enough topic to be
                                addressed on its own.
which are pretty
closely tied together.
MANAGING
NESTED VIEWS
While writing to the       Problems
DOM doesn’t seem
                           ■ Zombie Views and Events
too hard, once you
start nesting views it’s   ■ Re-rendering
easy to trip up.
ZOMBIES

          Zombies - views or events that don’t die

          Usually this happens because a parent re-
          rendered or was destroyed and forgot to
          teardown the child.

          In the case of events, an event handler
          was set up and never removed.
EVENTS
destroy: function () {
  var c = this; this.unbind();
  try {
    this._element.pause(),
    this._element.removeEventListener("error",
                                       this._triggerError),
    this._element.removeEventListener("ended", this._triggerEnd),
    this._element.removeEventListener("canplay",
                                       this._triggerReady),
    this._element.removeEventListener("loadedmetadata",
                                       this._onLoadedMetadata),
    _.each(b, function (a) {
      c._element.removeEventListener(a, c._bubbleProfilingEvent)
    }),
    _.each(a, function (a) {
      c._element.removeEventListener(a, c._logEvent)
    }),
    this._element = null, this.trigger("destroy")
  } catch (d) {}
                                                 This is from Rdio’s app

                                                 The point is not to knock on Backbone,
                                                 but to realize that there’s a lot to
                                                 remember about and it’s easy to miss
                                                 things. This is how zombies happen.
VIEWS




If we want to open at 8am, we need to re-
render the App View. In order to re-render
the App View, the App View must also         The issue here occurs if we re-render the
manually re-render the child views and re-   App View and don’t properly tear-down
insert them into App View's element.         the Menu and Menu Item views. We
                                             could easily end up with Zombie events
                                             and memory leaks.
HANDLING EVENTS
Web applications need    ■ Inconsistent Behavior
to handle a wide
                         ■ Setup and Teardown
variety of DOM
events. It’s easy to     ■ Performance
handle just a few, but
                                                   Sort of a continuation
problems arise with                                from the last point.


more.
Lots of individual handlers can be slow.
Not to mention the fact that you have to set
up different handlers for each event type.
SOLUTIONS
BUILT-IN
CHILD VIEWS
Views are fully aware   ■ Smarter re-rendering
of their children,
                        ■ Automatic binding and
which means less
                          observer cleanup
work for your app.
In this example, you can see that the views are
nested. If we need to re-render the AppView,
Ember tearsdown the children and then re-
renders them at the appropriate time.

Ember cleans up any bindings and obser vers for
views (and other objects) when destroyed.

As it turns out event teardown doesn’t really
matter.
JQUERY
One of the many          ■ Regularizes DOM event
things jQuery does for     bubbling
Ember is help to
                         ■ Provides the `on` method for
normalize event            delegation
handling.




                                 Doesn’t quite merit its own slide, but it is worth
                                 mentioning that we outsource tough problems when we
                                 can. We’re a bit lazy, even if it doesn’t look like it. We
                                 don’t want to deal with problems if someone else
                                 already does it well.
EVENT DELEGATION
Ember implements an    ■ Single Event Handler
event delegator that
                       ■ Passes events to correct view
handles all inbound
events and sends       ■ Event setup and teardown
them the correct
location.
Individual views don’t actually have any event
listeners. We just assign an `ember-view` class
to them that allows jQuery.on to register their
events. No worries about zombie events here.
MORE
SOLUTIONS
HANDLEBARS
Integrated Handlebars   ■ Child views
helpers allow you to
                        ■ Event helpers
write less code
without losing any of   ■ Bound properties
Ember’s benefits.
VIRTUAL VIEWS
Ember uses a purpose    ■ Allows for binding content to
built library called      the DOM
Metamorph for
                        ■ No use of HTML elements
updating parts of the
DOM.                    ■ Doesn’t affect CSS
Handlebars
<div id="name">
  {{name}}
</div>


                    HTML
<div id="name">
  <script id="metamorph−5−start" type="text/x
−placeholder"></script>
    John Doe
  <script id="metamorph−5−end" type="text/x
−placeholder"></script>
</div>
END
EMBERJS.COM
@WAGENET

Contenu connexe

Similaire à Ember - Sophisticated Views

Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiJared Faris
 
Ryan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was GoodRyan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was GoodFITC
 
Marionette - TorontoJS
Marionette - TorontoJSMarionette - TorontoJS
Marionette - TorontoJSmatt-briggs
 
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa..."Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa...Fwdays
 
Getting Started with React-Nathan Smith
Getting Started with React-Nathan SmithGetting Started with React-Nathan Smith
Getting Started with React-Nathan SmithTandemSeven
 
Backbone.js – an introduction
Backbone.js – an introductionBackbone.js – an introduction
Backbone.js – an introductionbobbyroe
 
Win8 development lessons learned jayway
Win8 development lessons learned jaywayWin8 development lessons learned jayway
Win8 development lessons learned jaywayAndreas Hammar
 
React js Rahil Memon
React js Rahil MemonReact js Rahil Memon
React js Rahil MemonRahilMemon5
 
AngularJS preso with directives and route resolve
AngularJS preso with directives and route resolveAngularJS preso with directives and route resolve
AngularJS preso with directives and route resolveBrent Goldstein
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistMark Fayngersh
 
Embracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think ResponsivelyEmbracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think ResponsivelyChad Currie
 
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User ExperienceNagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User ExperienceNagios
 
Windows Store apps - Lessons Learned
Windows Store apps - Lessons LearnedWindows Store apps - Lessons Learned
Windows Store apps - Lessons Learnedchribben
 
Getting Started with React
Getting Started with ReactGetting Started with React
Getting Started with ReactNathan Smith
 
Effective debugging
Effective debuggingEffective debugging
Effective debuggingAndy Dawson
 
Conquering Gef Part 1: Effectively creating a well designed graphical editor
Conquering Gef Part 1: Effectively creating a well designed graphical editorConquering Gef Part 1: Effectively creating a well designed graphical editor
Conquering Gef Part 1: Effectively creating a well designed graphical editorVineet Sinha
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptAndrew Lovett-Barron
 

Similaire à Ember - Sophisticated Views (20)

Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript Spaghetti
 
Mobile optimization
Mobile optimizationMobile optimization
Mobile optimization
 
Intro to react_v2
Intro to react_v2Intro to react_v2
Intro to react_v2
 
Ryan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was GoodRyan Christiani I Heard React Was Good
Ryan Christiani I Heard React Was Good
 
Marionette - TorontoJS
Marionette - TorontoJSMarionette - TorontoJS
Marionette - TorontoJS
 
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa..."Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
 
Getting Started with React-Nathan Smith
Getting Started with React-Nathan SmithGetting Started with React-Nathan Smith
Getting Started with React-Nathan Smith
 
Backbone.js – an introduction
Backbone.js – an introductionBackbone.js – an introduction
Backbone.js – an introduction
 
Win8 development lessons learned jayway
Win8 development lessons learned jaywayWin8 development lessons learned jayway
Win8 development lessons learned jayway
 
React js Rahil Memon
React js Rahil MemonReact js Rahil Memon
React js Rahil Memon
 
Ruby For Startups
Ruby For StartupsRuby For Startups
Ruby For Startups
 
AngularJS preso with directives and route resolve
AngularJS preso with directives and route resolveAngularJS preso with directives and route resolve
AngularJS preso with directives and route resolve
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
 
Embracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think ResponsivelyEmbracing Uncertainty: Learning to Think Responsively
Embracing Uncertainty: Learning to Think Responsively
 
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User ExperienceNagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
Nagios Conference 2012 - Nathan Vonnahme - Monitoring the User Experience
 
Windows Store apps - Lessons Learned
Windows Store apps - Lessons LearnedWindows Store apps - Lessons Learned
Windows Store apps - Lessons Learned
 
Getting Started with React
Getting Started with ReactGetting Started with React
Getting Started with React
 
Effective debugging
Effective debuggingEffective debugging
Effective debugging
 
Conquering Gef Part 1: Effectively creating a well designed graphical editor
Conquering Gef Part 1: Effectively creating a well designed graphical editorConquering Gef Part 1: Effectively creating a well designed graphical editor
Conquering Gef Part 1: Effectively creating a well designed graphical editor
 
Intro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate JavascriptIntro to BackboneJS + Intermediate Javascript
Intro to BackboneJS + Intermediate Javascript
 

Dernier

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Dernier (20)

08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

Ember - Sophisticated Views

  • 1. SOPHISTICATED VIEWS How Ember's View Layer Handles the Complex Problems
  • 2.
  • 3. ME
  • 4. PETER WAGENET ■ Tilde Employee ■ Ember Core Team Member ■ Former SproutCore Core Team Member ■ Ruby on Rails Developer
  • 6. A FRAMEWORK FOR CREATING AMBITIOUS WEB APPLICATIONS How many here are familiar with Ember? What do you all use?
  • 8. WHY EMBER? There’s a myriad of ■ No trivial choices JavaScript application ■ Write less code frameworks. Here are some reasons to pick ■ We solve the complex Ember. problems I’d rather sell you on philosophy than features. It’s more important for you to know how we approach problems.
  • 10. SOME PROBLEMS There are a number of ■ Managing Nested Views complex problems that ■ Handling Events Ember tackles. We’ll focus on two of them Event handling is in some ways a subset of nested views, but is a large enough topic to be addressed on its own. which are pretty closely tied together.
  • 11. MANAGING NESTED VIEWS While writing to the Problems DOM doesn’t seem ■ Zombie Views and Events too hard, once you start nesting views it’s ■ Re-rendering easy to trip up.
  • 12. ZOMBIES Zombies - views or events that don’t die Usually this happens because a parent re- rendered or was destroyed and forgot to teardown the child. In the case of events, an event handler was set up and never removed.
  • 13. EVENTS destroy: function () { var c = this; this.unbind(); try { this._element.pause(), this._element.removeEventListener("error", this._triggerError), this._element.removeEventListener("ended", this._triggerEnd), this._element.removeEventListener("canplay", this._triggerReady), this._element.removeEventListener("loadedmetadata", this._onLoadedMetadata), _.each(b, function (a) { c._element.removeEventListener(a, c._bubbleProfilingEvent) }), _.each(a, function (a) { c._element.removeEventListener(a, c._logEvent) }), this._element = null, this.trigger("destroy") } catch (d) {} This is from Rdio’s app The point is not to knock on Backbone, but to realize that there’s a lot to remember about and it’s easy to miss things. This is how zombies happen.
  • 14. VIEWS If we want to open at 8am, we need to re- render the App View. In order to re-render the App View, the App View must also The issue here occurs if we re-render the manually re-render the child views and re- App View and don’t properly tear-down insert them into App View's element. the Menu and Menu Item views. We could easily end up with Zombie events and memory leaks.
  • 15. HANDLING EVENTS Web applications need ■ Inconsistent Behavior to handle a wide ■ Setup and Teardown variety of DOM events. It’s easy to ■ Performance handle just a few, but Sort of a continuation problems arise with from the last point. more.
  • 16. Lots of individual handlers can be slow. Not to mention the fact that you have to set up different handlers for each event type.
  • 18. BUILT-IN CHILD VIEWS Views are fully aware ■ Smarter re-rendering of their children, ■ Automatic binding and which means less observer cleanup work for your app.
  • 19. In this example, you can see that the views are nested. If we need to re-render the AppView, Ember tearsdown the children and then re- renders them at the appropriate time. Ember cleans up any bindings and obser vers for views (and other objects) when destroyed. As it turns out event teardown doesn’t really matter.
  • 20. JQUERY One of the many ■ Regularizes DOM event things jQuery does for bubbling Ember is help to ■ Provides the `on` method for normalize event delegation handling. Doesn’t quite merit its own slide, but it is worth mentioning that we outsource tough problems when we can. We’re a bit lazy, even if it doesn’t look like it. We don’t want to deal with problems if someone else already does it well.
  • 21. EVENT DELEGATION Ember implements an ■ Single Event Handler event delegator that ■ Passes events to correct view handles all inbound events and sends ■ Event setup and teardown them the correct location.
  • 22. Individual views don’t actually have any event listeners. We just assign an `ember-view` class to them that allows jQuery.on to register their events. No worries about zombie events here.
  • 24.
  • 25. HANDLEBARS Integrated Handlebars ■ Child views helpers allow you to ■ Event helpers write less code without losing any of ■ Bound properties Ember’s benefits.
  • 26. VIRTUAL VIEWS Ember uses a purpose ■ Allows for binding content to built library called the DOM Metamorph for ■ No use of HTML elements updating parts of the DOM. ■ Doesn’t affect CSS
  • 27. Handlebars <div id="name"> {{name}} </div> HTML <div id="name"> <script id="metamorph−5−start" type="text/x −placeholder"></script> John Doe <script id="metamorph−5−end" type="text/x −placeholder"></script> </div>
  • 28. END