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

0.1.13 • 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

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i @3xpo/timedout

    Weekly Downloads

    4

    Version

    0.1.13

    License

    MIT

    Unpacked Size

    10.1 kB

    Total Files

    11

    Last publish

    Collaborators

    • exponentialworkload