Fixed Promise

by Arnaud Buchholz

JavaScript

var oPromiseExample = new Promise(function (resolve, reject) {
	setTimeout(function () {
  	try {
      doSomethingElse();
      resolve();
    } catch (e) {
    	reject(e);
    }
  }, 100);
});

oPromiseExample.then(function () {
	alert("OK");
}, function (reason) {
	alert("KO: " + reason);
})