https://github.com/tomashubelbauer/js-deferred
Deferred promise implementation for those times when you do actually need it which is not that rare
https://github.com/tomashubelbauer/js-deferred
async async-await defer deferred deferred-promise javascript promise
Last synced: 2 months ago
JSON representation
Deferred promise implementation for those times when you do actually need it which is not that rare
- Host: GitHub
- URL: https://github.com/tomashubelbauer/js-deferred
- Owner: TomasHubelbauer
- Created: 2020-06-13T11:41:33.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2022-04-14T20:28:59.000Z (about 4 years ago)
- Last Synced: 2025-07-29T17:35:47.101Z (11 months ago)
- Topics: async, async-await, defer, deferred, deferred-promise, javascript, promise
- Language: Markdown
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JavaScript Deferred Promise
A copy-paste friendly implementation of the deferred promise pattern ready for
you to use, because this pattern is useful no matter what others may tell you.
```js
export default class Deferred extends Promise {
constructor() {
let _resolve;
let _reject;
super((resolve, reject) => {
_resolve = resolve;
_reject = reject;
});
this.resolve = _resolve;
this.reject = _reject;
}
}
Deferred.prototype.constructor = Promise;
```
https://stackoverflow.com/a/48159603/2715716