Created
December 10, 2014 21:20
-
-
Save devdays/ed3de3c84c02dcb2b0eb to your computer and use it in GitHub Desktop.
Object JavaScript - Creating promise in ECMAScript
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 promise = new Promise( | |
function (resolve, reject) { // (A) | |
// ... | |
if ( /*...*/ ) { | |
resolve(value); // success | |
} else { | |
reject(reason); // failure | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment