p-defer/index.js

15 lines
227 B
JavaScript
Raw Normal View History

2016-10-21 05:07:52 +00:00
'use strict';
const pDefer = () => {
2019-03-17 12:24:05 +00:00
const deferred = {};
2016-10-21 05:07:52 +00:00
2019-03-17 12:24:05 +00:00
deferred.promise = new Promise((resolve, reject) => {
deferred.resolve = resolve;
deferred.reject = reject;
2016-10-21 05:07:52 +00:00
});
2019-03-17 12:24:05 +00:00
return deferred;
2016-10-21 05:07:52 +00:00
};
module.exports = pDefer;