Skip to content

jashlu/js-sleep-ms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

js-sleep-ms

A lightweight utility function that pauses execution for a specified duration using promises. This simple sleep function can be used to add delays in asynchronous JavaScript code.

Features

  • Pauses execution for the specified number of milliseconds.
  • Leverages promises for seamless integration with async/await syntax
  • Includes error handling for invalid input to ensure robustness.

Inspiration for this package comes from personal usage of Python's time sleep function.

Installation

To use this function in your project, copy the code into your desired file or add it as a custom module.

npm install js-sleep-ms

Usage

const sleep = require("js-sleep-ms")

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published