@3xpo/timedout
TypeScript icon, indicating that this package has built-in type declarations

0.1.12 • Public • Published

@3xpo/timedout

Compromise-less Microlibrary for making promises with timeouts.

Installation

pnpm i @3xpo/timedout;

Usage

import timedout from '@3xpo/timedout';

const promise = timedout(
  new Promise(resolve => setTimeout(() => resolve('hi!'), 500)),
  1000,
); // will resolve after 500ms, with 'hi!'
const promise2 = timedout(
  new Promise(resolve => setTimeout(() => resolve('hi!'), 10000)),
  1000,
); // will reject after 1s

Package Sidebar

Install

npm i @3xpo/timedout

Weekly Downloads

5

Version

0.1.12

License

MIT

Unpacked Size

10 kB

Total Files

11

Last publish

Collaborators

  • exponentialworkload