Skip to content

Instantly share code, notes, and snippets.

@SeanChristopherConway
Created May 19, 2016 22:10
Show Gist options
  • Save SeanChristopherConway/d908a5949461b0aced542f469b38081f to your computer and use it in GitHub Desktop.
Save SeanChristopherConway/d908a5949461b0aced542f469b38081f to your computer and use it in GitHub Desktop.
var RSVP = require('rsvp');
var fakePromise = function (obj) {
var promise = new RSVP.Promise(function (resolve, reject) {
// succeed
resolve({
state: true
});
// or reject
reject(error);
});
return promise;
};
fakePromise({
id: 1
})
.then(function (value) {
console.log("I promise %s",JSON.stringify(value));
})
.catch(function (error) {
// failure
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment