JSFiddle - React, Tailwind, and code Playground
by sumit_skr
JavaScript
var Promise = function(){
//this.pending = [];
}
Promise.prototype = {
then: function(onResolve, onReject){
resolve = onResolve;
return resolve;
},
resolve: function(data){
this.then = function(resolve){
resolve && resolve(data)
}
this.executePending('resolve', data)
},
executePending: function(type, data){
var p, i = 0
while (p = this.pending[i++]) {
p[type] && p[type](data)
}
delete this.pending
}
}