# @tc39-proposal/defer

> TC39 proposal: Implementation of Promise.withResolvers

Latest version **0.0.1** (published 2023-11-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install @tc39-proposal/defer
pnpm add @tc39-proposal/defer
yarn add @tc39-proposal/defer
bun add @tc39-proposal/defer
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2023-11-08 |
| First published | 2023-11-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | simu |
| Maintainers | simumn |
| Keywords | Promise.withResolvers, tc39, tc39 proposal, defer |

## Links

- npm: https://www.npmjs.com/package/@tc39-proposal/defer
- Repository: https://github.com/simo-an/tc39-proposal
- Homepage: https://github.com/simo-an/tc39-proposal/main/packages/defer
- Issues: https://github.com/simo-an/tc39-proposal/issues
- npm.io page: https://npm.io/package/@tc39-proposal/defer

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.1 (latest) — 2023-11-08

## README

## TC39 proposal

https://github.com/tc39/proposal-promise-with-resolvers

https://tc39.es/proposal-promise-with-resolvers/

## Install

Install `@tc39-proposal/defer` by `pnpm`

```bash
pnpm add @tc39-proposal/defer
```

## Basic Usage

```ts
import { createDefer } from "@tc39-proposal/defer";

function sleep(duration?: number) {
  const defer = createDefer();

  try {
    setTimeout(defer.resolve, duration);
  } catch (error) {
    defer.reject(error);
  }

  return defer.promise;
}
```

## Others

Welcome to contribute and make @tc39-proposal/defer better!

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