@sz-sw/promise-x
v2.0.1
Published
Creates a `Promise` that is externally resovable/rejectable:
Downloads
2
Readme
@sz-sw/promise-x
Creates a Promise
that is externally resovable/rejectable:
const PromiseX = require("@sz-sw/promise-x")
const myPromise = PromiseX.create()
myPromise
.then(value => {
console.log("Promise fullfilled with value", value)
})
// Resolve promise after 1 second
setTimeout(myPromise.__resolve, 1000, 10)
Interface:
.then()
, .catch()
, .finally()
, .__resolve()
, .__reject()