Meta tweaks
This commit is contained in:
parent
3510168005
commit
1eff146400
|
@ -22,6 +22,4 @@ export interface DeferredPromise<ValueType> {
|
|||
/**
|
||||
Create a deferred promise.
|
||||
*/
|
||||
export default function pDefer<ValueType = unknown>(): DeferredPromise<
|
||||
ValueType
|
||||
>;
|
||||
export default function pDefer<ValueType = unknown>(): DeferredPromise<ValueType>;
|
||||
|
|
10
index.js
10
index.js
|
@ -1,14 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
const pDefer = () => {
|
||||
const ret = {};
|
||||
const deferred = {};
|
||||
|
||||
ret.promise = new Promise((resolve, reject) => {
|
||||
ret.resolve = resolve;
|
||||
ret.reject = reject;
|
||||
deferred.promise = new Promise((resolve, reject) => {
|
||||
deferred.resolve = resolve;
|
||||
deferred.reject = reject;
|
||||
});
|
||||
|
||||
return ret;
|
||||
return deferred;
|
||||
};
|
||||
|
||||
module.exports = pDefer;
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
> 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
|
||||
|
||||
```
|
||||
$ npm install --save p-defer
|
||||
$ npm install p-defer
|
||||
```
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue