data already populated. • Slow connections also problematic. • Page will be redirected to if AJAX request doesn’t return in time. • Empty template. • Not good. Thursday, June 28, 12
loaded for first time, starts polling loop. • Only retrieves data if template is displayed. • Polling loop for each tab. • Unnecessary and expensive. Thursday, June 28, 12
duplicate information. • Load information into objects, and share between the sections. • Views updated automatically. • One polling loop. Thursday, June 28, 12
Define a series of application states. • Based on state, can be used to: • Control visible elements on page. • Control polling based on selection. Thursday, June 28, 12
serialization of state via the URL. • Nested ViewStates only appended objects to the DOM, couldn’t control insertion point. • More not listed here, see: http:// tomdale.net/2012/05/ember-routing/ Thursday, June 28, 12
Define a series of routes, which are just states with an additional route property. • Route property used to build URL. • URL serializes the current state of your application. Thursday, June 28, 12
inferred, for example: • snapshot -> App.SnapshotView. • snapshot -> App.SnapshotController • Controller and view are instantiated. • context is bound to content on the controller. Thursday, June 28, 12
objects in application data store. • Inspect current state to determine which objects to poll and update. • Cleanly isolates XHR polling loop outside of view/templating so it can be switched to a more robust solution (ie. Comet, WebSockets.) Thursday, June 28, 12
Ember Data: Lots of things don’t work yet. • Ember Router built around using Ember Data; assumption that you’ll have objects returned immediately that are loaded async. • Ember Router: not officially recommended for production, at least until 1.0. Thursday, June 28, 12