An open API service indexing awesome lists of open source software.

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

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