The Smallest & Fastest TS Promise lib.
npm install lie-tssetImediate method and uses it. Checks in this order for these methods:
setImediate method attached to window or global object.
window.postMessage is possible, uses an ultra fast messaging method to polyfill setImediate.
setTimeout if everything else fails.
ts
new Promise(function(res, rej) {
res(1,2,3);
}).then(function(v1,v2,v3) {
console.log(v1,v2,v3) // <= 1, 2, 3
})
`
Install
`bash
npm install lie-ts
`
You can also grab the compressed, minified file fom the /dist folder of this repository.
Usage
`javascript
// Common JS/node
var Promise = require('lie-ts').Promise;
// ES6/ Typescript
import { Promise } from "lie-ts";
// Take over global/window Promise object if it doesn't exist already.
Promise.doPolyfill();
`
You can also just drop the minified lib from the /dist folder directly into a