1.0.1 • Published 4 years ago

@andytan07/delay-es v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

delay-es

A simple stupid delay function based on ES6/ES7 Promise or async/await that tends to replace setTimeout without any extra functions.

To install,

> npm install --save @andytan07/delay-es

Usage:

const delay = require("@andytan07/delay-es");

// With ES6 Promise
console.log("Before delay");
delay(1000).then(() => console.log("Delayed 1000ms"));

// With ES7 async/await
(async () => {
  console.log("Before delay");
  await delay(1000);
  console.log("Delayed 1000ms");
})();

API

As simple as:

delay(milliseconds)

Create a promise that resolves after specified milliseconds

License

MIT © Andy Tan

1.0.1

4 years ago

1.0.0

4 years ago