JSFiddle - React, Tailwind, and code Playground
JavaScript
if (!Promise.prototype.spread) {
Promise.prototype.spread = function (fn) {
return this.then(function (args) {
return fn.apply(this, args); //this is always undefined in A+ complaint, but just in case
});
};
}
// shim resolve for current chrome since spec changed
var resolve = Promise.resolve || function(v){
return new Promise(function(r){
r(v);
});
};
resolve(null).then(function(){
return ["Hello","World","!"];
}).spread(function(a,b,c){
console.log(a,b+c);
});