Managing Dependencies

Managing Dependencies As you're developing your Ember app, you'll likely run into common scenarios that aren't addressed by Ember itself, such as authentication or using SASS for your stylesheets. Ember CLI provides a common format called Ember Addons for distributing reusable libraries to solve these problems. Additionally, you may want to make use of front-end dependencies like a CSS framework or a JavaScript datepicker that aren't specific to Ember apps. Ember CLI supports installing these

Test#promise()

promise (resolver, label) public Defined in packages/ember-testing/lib/test/promise.js:21 This returns a thenable tailored for testing. It catches failed onSuccess callbacks and invokes the Ember.Test.adapter.exception callback in the last chained then. This method should be returned by async helpers such as wait. Parameters: resolver Function The function used to resolve the promise. label String An optional string for identifying the promise.

Ember.changeProperties()

changeProperties (callback, binding) private Defined in packages/ember-metal/lib/property_events.js:226 Make a series of property changes together in an exception-safe way. Ember.changeProperties(function() { obj1.set('foo', mayBlowUpWhenSet); obj2.set('bar', baz); }); Parameters: callback Function binding []

DefaultResolver#resolveView()

resolveView (parsedName) protected Defined in packages/ember-application/lib/system/resolver.js:315 Lookup the view using resolveOther Parameters: parsedName Object a parseName object with the parsed fullName lookup string

Test#keyEvent()

keyEvent (selector, type, keyCode) RSVP.Promisepublic Defined in packages/ember-testing/lib/helpers.js:64 Available since 1.5.0 Simulates a key event, e.g. keypress, keydown, keyup with the desired keyCode Example: keyEvent('.some-jQuery-selector', 'keypress', 13).then(function() { // assert something }); Parameters: selector String jQuery selector for finding element on the DOM type String the type of key event, e.g. `keypress`, `keydown`, `keyup` keyCode Number the keyCode

AutoLocation#global

globalprivate Defined in packages/ember-routing/lib/location/auto_location.js:64 Available since 1.11 Default: window

Router#didTransition()

didTransitionpublic Defined in packages/ember-routing/lib/system/router.js:227 Available since 1.2.0 Handles updating the paths and notifying any listeners of the URL change. Triggers the router level didTransition hook. For example, to notify google analytics when the route changes, you could use this hook. (Note: requires also including GA scripts, etc.) let Router = Ember.Router.extend({ location: config.locationType, didTransition: function() { this._super(...arguments); r

RSVP.race()

race (array, label) static Inherited from RSVP but overwritten in bower_components/rsvp/lib/rsvp/race.js:3 This is a convenient alias for RSVP.Promise.race. Parameters: array Array Array of promises. label String An optional label. This is useful for tooling.

Ember.inject.service()

service (name) Ember.InjectedPropertypublic Defined in packages/ember-runtime/lib/system/service.js:5 Available since 1.10.0 Creates a property that lazily looks up a service in the container. There are no restrictions as to what objects a service can be injected into. Example: App.ApplicationRoute = Ember.Route.extend({ authManager: Ember.inject.service('auth'), model: function() { return this.get('authManager').findCurrentUser(); } }); This example will create an authManager p

Ember.computed.sort()

sort (itemsKey, sortDefinition) Ember.ComputedPropertypublic Defined in packages/ember-runtime/lib/computed/reduce_computed_macros.js:584 A computed property which returns a new array with all the properties from the first dependent array sorted based on a property or sort function. The callback method you provide should have the following signature: function(itemA, itemB); itemA the first item to compare. itemB the second item to compare. This function should return negative number (e.g