quick-promise
v0.1.0
Published
QuickPromise. Resolve Synchronously When Possible.
Downloads
3,368
Maintainers
Readme
quick-promise
QuickPromise. Resolve Synchronously When Possible.
usage
import QuickPromise from "quick-promise";
QuickPromise.all
let resolved = false;
QuickPromise.all([1, 2]).then(nums => (resolved = true));
// resolved is true
let resolved = false;
QuickPromise.all([fetch(url), 9]).then([response, n]) => (resolved = true));
// resolved is false
QuickPromise.resolve
let resolved = false;
QuickPromise.resolve(1).then(num => (resolved = true));
// resolved is true
let resolved = false;
QuickPromise.resolve(fetch(url)).then(response => (resolved = true));
// resolved is false
let resolved = false;
await QuickPromise.resolve(fetch(url)).then(response => (resolved = true));
// resolved is true