0.0.2 • Published 4 years ago

clearable-delay v0.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

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

0.0.2

4 years ago

0.0.1

4 years ago