@jellybeanci/sleep
v0.0.1
Published
Promise based async sleep function.
Downloads
5
Readme
sleep
Promise based async sleep function.
npm i @jellybeanci/sleep
import module
// ES6 Syntax
import {sleep, delay} from "@jellybeanci/sleep";
// Commonjs Syntax
const {sleep, delay} = require("@jellybeanci/sleep");
usage
console.log("See you after 5 sec");
await sleep(5000);
console.log("5 sec passed");
console.log("See you after 5 sec");
await delay(5);
console.log("5 sec passed");
types
type sleep = (millisecond: number) => Promise<unknown>;
type delay = (second: number) => Promise<unknow>;