1.2.1 • Published 6 months ago

@chargedcloud/promise-sleep v1.2.1

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
6 months ago

@chargedcloud/promise-sleep

The promise-sleep package is a simple function who returns a promise that resolves after a certain amount of time.

InstallationUsage

Installation

You can install the package using npm:

npm install @chargedcloud/promise-sleep

Usage

First, you need to import the package:

// CommonJS
const sleep = require("@chargedcloud/promise-sleep");

// ES6
import sleep from "@chargedcloud/promise-sleep";

Then, you can use the function passing the amount of time in milliseconds:

// Sleep for 1 second
await sleep(1000);

// Sleep for 1 second and then log "Hello, world!"
await sleep(1000).then(() => console.log("Hello, world!"));
1.2.1

6 months ago

1.2.0

7 months ago

1.1.0

7 months ago

1.0.0

9 months ago