stormbytes

Untitled

Jun 1st, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var promise = new Promise(function(resolve, reject) {
  2.   // do a thing, possibly async, then…
  3.  
  4.   if (/* everything turned out fine */) {
  5.     resolve("Stuff worked!");
  6.   }
  7.   else {
  8.     reject(Error("It broke"));
  9.   }
  10. });
Advertisement
Add Comment
Please, Sign In to add comment