Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/willybrauner/deferred-promise
🙏🏽 Create a deferred promise who can be resolved or rejected from anywhere.
https://github.com/willybrauner/deferred-promise
javascript lib library promise typescript
Last synced: 8 days ago
JSON representation
🙏🏽 Create a deferred promise who can be resolved or rejected from anywhere.
- Host: GitHub
- URL: https://github.com/willybrauner/deferred-promise
- Owner: willybrauner
- Created: 2021-01-10T21:51:55.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-25T10:24:09.000Z (about 3 years ago)
- Last Synced: 2024-08-09T21:26:07.155Z (3 months ago)
- Topics: javascript, lib, library, promise, typescript
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@wbe/deferred-promise
- Size: 634 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @wbe/deferred-promise
Create a deferred promise who can be resolved or rejected from anywhere.
![](https://img.shields.io/npm/v/@wbe/deferred-promise/latest.svg)
![](https://img.shields.io/bundlephobia/minzip/@wbe/deferred-promise.svg)
![](https://img.shields.io/npm/dt/@wbe/deferred-promise.svg)
![](https://img.shields.io/npm/l/@wbe/deferred-promise.svg)## Installation
```shell script
$ npm install -s @wbe/deferred-promise
```## How to use
```js
import { deferredPromise } from "@wbe/deferred-promise";// create deferred promise
const deferred = deferredPromise();deferred.promise.then(() => {
// deferredPromise is resolved!
});// when needed, resolve this promise
deferred.resolve();// or reject it
deferred.reject();
```