Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Last active February 27, 2017 11:08
Show Gist options
  • Save gskachkov/b000bf893d80462bbec04e21bc547cca to your computer and use it in GitHub Desktop.
Save gskachkov/b000bf893d80462bbec04e21bc547cca to your computer and use it in GitHub Desktop.
Example of resolve promise
// 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