Last active
February 27, 2017 11:08
-
-
Save gskachkov/b000bf893d80462bbec04e21bc547cca to your computer and use it in GitHub Desktop.
Example of resolve 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
// Create promise | |
var promise = new Promise(function (resolve) { | |
//Resolve promise in 50ms with string 'success' | |
setTimeout(function () { resolve('success'); }, 50); | |
}); | |
// Handle successful resolve of promise | |
promise.then(function (result) { | |
console.log(result); // Print: success | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment