@helper-modules/sleep

1.0.0 • Public • Published

@helper-modules/sleep

Allows to delay the process

Installation

npm i @helper-modules/sleep

Usage

Syntex

sleep(ms: Number);
  • Params:
    • ms:
      • type: Number
      • default: undefined

Common Usage

const sleep = require("@helper-modules/sleep");
// or
const { sleep } = require("@helper-modules/all");

async function run(){
    console.log("Saying Hello in 2 seconds");
    await sleep(2000);
    console.log("Hello World"); // "Hello World" After 2 Seconds
}

run();

sleep helper-module returns Promise which will resolve after the given number of milliseconds. Which Simply use setTimeout native Javascript function.

Readme

Keywords

Package Sidebar

Install

npm i @helper-modules/sleep

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

1.86 kB

Total Files

6

Last publish

Collaborators

  • helper-modules