0.1.0 • Published 7 months ago

@steeringwaves/sleep v0.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

@steeringwaves/sleep

workflow

A typescript async sleep utility.

Example

Promises

const Sleep = require("@steeringwaves/sleep").default;

Sleep(500).then(() => console.log("500ms sleep finished")); // sleep 500ms
await Sleep(1000); // sleep 1s
console.log("1s sleep finished");

Using contexts

const Context = require("@steeringwaves/context").default;
const Sleep = require("@steeringwaves/sleep").default;

const ctx = new Context();

Sleep(2000)
	.setContext(ctx)
	.onCancel(() => {
		console.log("sleep canceled");
	})
	.then(() => console.log("sleep completed"))
	.catch((e) => console.log(e));

ctx.Done();
0.1.0

7 months ago

0.0.6

11 months ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago