Meta tweaks
This commit is contained in:
parent
3510168005
commit
1eff146400
|
@ -22,6 +22,4 @@ export interface DeferredPromise<ValueType> {
|
||||||
/**
|
/**
|
||||||
Create a deferred promise.
|
Create a deferred promise.
|
||||||
*/
|
*/
|
||||||
export default function pDefer<ValueType = unknown>(): DeferredPromise<
|
export default function pDefer<ValueType = unknown>(): DeferredPromise<ValueType>;
|
||||||
ValueType
|
|
||||||
>;
|
|
||||||
|
|
10
index.js
10
index.js
|
@ -1,14 +1,14 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const pDefer = () => {
|
const pDefer = () => {
|
||||||
const ret = {};
|
const deferred = {};
|
||||||
|
|
||||||
ret.promise = new Promise((resolve, reject) => {
|
deferred.promise = new Promise((resolve, reject) => {
|
||||||
ret.resolve = resolve;
|
deferred.resolve = resolve;
|
||||||
ret.reject = reject;
|
deferred.reject = reject;
|
||||||
});
|
});
|
||||||
|
|
||||||
return ret;
|
return deferred;
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = pDefer;
|
module.exports = pDefer;
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
|
|
||||||
> Create a deferred promise
|
> Create a deferred promise
|
||||||
|
|
||||||
[**Don't use this unless you know what you're doing!**](https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns#the-deferred-anti-pattern) Prefer the `Promise` constructor.
|
[Don't use this unless you know what you're doing.](https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns#the-deferred-anti-pattern) Prefer the `Promise` constructor.
|
||||||
|
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
```
|
```
|
||||||
$ npm install --save p-defer
|
$ npm install p-defer
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue