@xarc/defer
v1.0.0
Published
create a Promise defer object with resolve/reject
Downloads
457
Keywords
Readme
defer
const makeDefer = require("@xarc/defer");
const defer = makeDefer();
setTimeout(() => defer.resolve("test"), 100);
defer.promise.then(x => console.log("defer promise resolved", x));
Using custom Promise
const Promise = require("bluebird");
const makeDefer = require("@xarc/defer");
const defer = makeDefer(Promise);
API
makeDefer([Promise]);
Returns defer object:
{
promise, resolve, reject;
}