Unfancy promise based sleep function
$ npm install @tiaanduplessis/nap
# OR
$ yarn add @tiaanduplessis/napimport nap from '@tiaanduplessis/nap' nap().then(() => console.log('Took a 1 sec nap')) nap(3000).then(() => console.log('Took a 3 sec nap')) nap(5000).then(() => console.log('Took a 5 sec nap')) async function doThings () { await nap(4000) console.log('Took a 4 sec nap') } doThings() // Took a 1 sec nap // Took a 3 sec nap // Took a 4 sec nap // Took a 5 sec nap
Contributions are welcome!
- Fork it.
- Create your feature branch:
git checkout -b my-new-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request :D
Or open up a issue.
MIT