Posts / sleep#11

Sleep promise

By Toby Hinloopen at 2021-03-19 13:16

Installation

# npm
npm i https://boomm.io/p/11-sleep.tar.gz
# yarn
yarn add https://boomm.io/p/11-sleep.tar.gz

Usage

const sleep = require("11-sleep");

Source

module.exports = function sleep(seconds) {
  return new Promise((resolve) => setTimeout(resolve, seconds * 1000));
};