Skip to content

Instantly share code, notes, and snippets.

@jkarsrud
Created September 29, 2014 23:53
Show Gist options
  • Save jkarsrud/8ce5f99282e51d23d20b to your computer and use it in GitHub Desktop.
Save jkarsrud/8ce5f99282e51d23d20b to your computer and use it in GitHub Desktop.
// Our model does some calls to a server or whatever
var model = new Ember.RSVP.Promise(function(resolve, reject){
if(someCondition){
resolve(someData);
} else {
reject(err);
}
});
// We access the data here, through the success/resolved and fail/rejected callbacks
model.then(function(someData) {
// Do whatever
}, function(err) {
// Send to magic error handler
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment