Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 576 Bytes

README.md

File metadata and controls

39 lines (28 loc) · 576 Bytes

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>;