This package has been deprecated

Author message:

WARNING: This project has been renamed to your-new-package-name. Install using tiny-delay instead.

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

1.0.0 • Public • Published

Tiny delay

Changeable and cancelable promise based delay / setTimeout implementation.

Example

Simple promise / callback based usage

import delay from "tiny-delay"

delay(1000).then(() => {
  console.log("1 second passed")
})

delay(1000, () => {
  console.log("1 second passed")
})

Cancel anytime

const timeout = tinyDelay(1000)

delay(500, () => {
  timeout.cancel()
})

Change timout duration

import { Data } from "josm"

const timoutDuration = new Data(1000)
const timeout = delay(timeoutDuration, () => {
  console.log("2 seconds passed")
})

delay(500, () => {
  timeoutDuration.set(2000)
})

Conribute

All feedback is appreciated. Create a pull request or write an issue.

Package Sidebar

Install

npm i proper-delay

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

7.74 kB

Total Files

8

Last publish

Collaborators

  • zzrv