Created
September 29, 2014 23:53
-
-
Save jkarsrud/8ce5f99282e51d23d20b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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