Hold ma BEER!
Let your app do something important
holdmabeer
is a simple package, that lets you create a Promise
, that resolves after a specific time.
Installation
npm install holdmabeer
Usage
holdmabeer
exports a hold
function, which accepts either a number or a string. When given a number, returns a Promise
that resolves after given number of milliseconds. String can be although in two formats - seconds or milliseconds. For example 420ms
or 69s
Examples
Just a simple promise, which resolves after 100 milliseconds
; ;
or
; ;
Promise, that resolves after 1 second
; ;
You can also use it inside an asynchronous function
; async { await ; console;};
Top-level await
is coming to JavaScript, so in some time it could be used like this:
; await ;console;
Contributing
- Do a fork of the repo
npm install
- Apply your changes, be sure to use Prettier for code formatting
- Create a pull request
- Well, it merge time, baby
License
This project is licensed under the MIT License.
Credits
Shameless plug
I'm an author of Require Podcast - Polish podcast about webdevelopment! If you're Polish, be sure to check it out!