Created
May 19, 2016 22:10
-
-
Save SeanChristopherConway/d908a5949461b0aced542f469b38081f to your computer and use it in GitHub Desktop.
This file contains 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
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