1.0.5 • Published 5 years ago

promisleep v1.0.5

Weekly downloads
7
License
MIT
Repository
github
Last release
5 years ago

Promisleep

Build Status Test Covarage Greenkeeper Latest Version

Promise based sleep function for Node and browser.

Installation

$ npm install promisleep

CDN

The library is available over a CDN:

<script src="https://unpkg.com/promisleep@latest/dist/promisleep.umd.js"></script>

<!-- Or the minified version -->
<script src="https://unpkg.com/promisleep@latest/dist/promisleep.umd.min.js"></script>

Usage

const promisleep = require("promisleep");

promisleep(3000)
  .then(() => console.log("⏰ Delayed for 3 seconds..."));

If you perfer to use the ES2016 async/await syntax:

import promisleep from "promisleep";

const letMeSleep = async () => {
  console.log("😴 I'm gonna sleep for 3 seconds...");

  await promisleep(5000);

  console.log("⏰ I woke up after 5 seconds...");
}

letMeSleep();

License

MIT © Risan Bagja Pradana

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

6 years ago