Objects, Properties & Actions
Nearly all of Ember's important types extend from a core
Some types of ember objects, like Routes, Controllers and Components can handle user interactions by way of actions. We'll cover strategies and best practices for action handling, including:
- closure actions
- action bubbling
Objects, Properties & ActionsObjects
We'll look at
Ember.Objectin detail, including:
- using the KVO-compliant get and set methods
- adding instance and static methods with
- lifecycle hooks
Objects, Properties & ActionsExercise: Extending Object
We'll create our own subclass of
extend(), and incorporate:
- proper handling of setup and tear-down logic
- firing events using
- getting and setting properties
Objects, Properties & ActionsServices
Services are a means of sharing state & functionality across various aspects of an app. We'll explain what makes services a simple, but powerful concept, and illustrate service use via
Ember.inject. Finally, we'll get a sneak preview of the important role services play in the upcoming engines framework feature, and explore the "do's and don'ts of service design*.
Objects, Properties & ActionsExercise: Services
We'll improve our bound handlebars helper, and take advantage of a service, so that we can share the concept of "current time" across many flavors of objects, and perform more efficient DOM updates.
Objects, Properties & ActionsComputed Properties
Computed properties are a performant and intuitive way to define values that are based on other values. We'll take a short trip through the internal implementation of a computed property, and contrast it with the more expensive and error-prone concept of Observers.