Created
November 24, 2014 13:18
-
-
Save montanaflynn/5df29ec41257857176cc to your computer and use it in GitHub Desktop.
Native node promise
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
var promise = new Promise(function(resolve, reject) { | |
if (true) { | |
resolve("wow") | |
} | |
else { | |
reject(Error("nope")) | |
} | |
}) | |
promise.then(function(res) { | |
console.log(res) | |
}, function(err) { | |
console.log(err) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment