# @r__d/cancelable-promise

> A simple cancelable promise

Latest version **2.3.1** (published 2017-09-19) · GPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install @r__d/cancelable-promise
pnpm add @r__d/cancelable-promise
yarn add @r__d/cancelable-promise
bun add @r__d/cancelable-promise
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.3.1 |
| Published | 2017-09-19 |
| First published | 2017-09-08 |
| Weekly downloads | 0 |
| License | GPL-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alkemics |
| Maintainers | r__d |

## Links

- npm: https://www.npmjs.com/package/@r__d/cancelable-promise
- Repository: https://github.com/RadekD/CancelablePromise
- Homepage: https://github.com/RadekD/CancelablePromise#readme
- Issues: https://github.com/RadekD/CancelablePromise/issues
- npm.io page: https://npm.io/package/@r__d/cancelable-promise

## Dependencies (1)

- [bluebird](https://npm.io/package/bluebird.md) ^3.5.0

## Recent versions

- 2.3.1 (latest) — 2017-09-19
- 2.3.0 — 2017-09-08

## README

# CancelablePromise
A simple Cancelable Promise for browser

## Install

```
npm install --save cancelable-promise
```

This package is based on ES6 Promise. See `promise-polyfill` for browser support.

## Usage
CancelablePromise acts like a ES6 Promise: you can use `Promise.all`, `Promise.race` with your CancelablePromise for example. The only difference is you'll have a `cancel` method on your promise to cancel future execution of `then` or `catch` functions. CancelablePromise will also cancel all callbacks attached to new promises returned by `then`/`catch`.
```
import CancelablePromise from 'cancelable-promise';
const myPromise = new CancelablePromise((resolve) => setTimeout(() => resolve('I\'m resolved'), 100));
myPromise.then((response) => console.log(response)).then(() => console.log('not cancel'));
myPromise.cancel();
// Nothing will be displayed in console
```

## Test
You can run tests with `npm run test`

---
_Source: https://npm.io/package/@r__d/cancelable-promise · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
