clearable-delay
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

clearable-delay

Delay a promise a specified amount of time with the ability to clear the delay.

Usage

import { clearableDelay } from "clearable-delay";
 
(async () => {
  const delayedPromise = clearableDelay(1000);
 
  setTimeout(() => delayedPromise.clear(), 500);
 
  const cleared = await delayedPromise;
 
  console.log(cleared ?
    "Cleared before timing out" :
    "Timed out after 1000ms");
})()

License

MIT © Andrei Sedoi

Readme

Keywords

Package Sidebar

Install

npm i clearable-delay

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

4.42 kB

Total Files

6

Last publish

Collaborators

  • bsnote