Services

Services An Ember.Service is an Ember object that lives for the duration of the application, and can be made available in different parts of your application. Services are useful for features that require shared state or persistent connections. Example uses of services might include: User/session authentication. Geolocation. WebSockets. Server-sent events or notifications. Server-backed API calls that may not fit Ember Data. Third-party APIs. Logging. Defining Services Services can be gener

Service

Ember.Service Class PUBLIC Extends: Ember.Object Defined in: packages/ember-runtime/lib/system/service.js:35 Module: ember

RSVP.rethrow()

rethrow (reason) static Defined in bower_components/rsvp/lib/rsvp/rethrow.js:1 RSVP.rethrow will rethrow an error on the next turn of the JavaScript event loop in order to aid debugging. Promises A+ specifies that any exceptions that occur with a promise must be caught by the promises implementation and bubbled to the last handler. For this reason, it is recommended that you always specify a second rejection handler function to then. However, RSVP.rethrow will throw the exception outside of

RSVP.resolve()

resolve (value, label) Promisestatic Inherited from RSVP but overwritten in bower_components/rsvp/lib/rsvp/resolve.js:3 This is a convenient alias for RSVP.Promise.resolve. Parameters: value * value that the returned promise will be resolved with label String optional string for identifying the returned promise. Useful for tooling. Returns: Promise a promise that will become fulfilled with the given `value`

RSVP.reject()

reject (reason, label) Promisestatic Inherited from RSVP but overwritten in bower_components/rsvp/lib/rsvp/reject.js:3 This is a convenient alias for RSVP.Promise.reject. Parameters: reason * value that the returned promise will be rejected with. label String optional string for identifying the returned promise. Useful for tooling. Returns: Promise a promise rejected with the given `reason`.

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.

RSVP.Promise#then()

then (onFulfillment, onRejection, label) Promise Defined in bower_components/rsvp/lib/rsvp/promise.js:184 The primary way of interacting with a promise is through its then method, which registers callbacks to receive either a promise's eventual value or the reason why the promise cannot be fulfilled. findUser().then(function(user){ // user is available }, function(reason){ // user is unavailable, and you are given the reason why }); Chaining The return value of then is itself a promise

RSVP.Promise#finally()

finally (callback, label) Promise Defined in bower_components/rsvp/lib/rsvp/promise.js:442 finally will be invoked regardless of the promise's fate just as native try/catch/finally behaves Synchronous example: findAuthor() { if (Math.random() > 0.5) { throw new Error(); } return new Author(); } try { return findAuthor(); // succeed or fail } catch(error) { return findOtherAuther(); } finally { // always runs // doesn't affect the return value } Asynchronous example: f

RSVP.Promise#catch()

catch (onRejection, label) Promise Defined in bower_components/rsvp/lib/rsvp/promise.js:410 catch is simply sugar for then(undefined, onRejection) which makes it the same as the catch block of a try/catch statement. function findAuthor(){ throw new Error('couldn't find that author'); } // synchronous try { findAuthor(); } catch(reason) { // something went wrong } // async with promises findAuthor().catch(function(reason){ // something went wrong }); Parameters: onRejection Fun

RSVP.Promise

RSVP.Promise Class Defined in: bower_components/rsvp/lib/rsvp/promise.js:34 Module: ember Promise objects represent the eventual result of an asynchronous operation. The primary way of interacting with a promise is through its then method, which registers callbacks to receive either a promise’s eventual value or the reason why the promise cannot be fulfilled. Terminology promise is an object or function with a then method whose behavior conforms to this specification. thenable is an obje