holddotjs

1.1.1 • Public • Published

Hold.js 🚌🏃🏻‍♂️

When something feels right... Hold on to it! :) A Javascript module for waiting different amounts of time.

Getting Started

Install

npm install holddotjs

Import

const hold = require('holddotjs');

API Reference

Hold.js API makes it easy to wait for milliseconds, seconds, minutes and even hours.

async function makeBusLeave() {
    await hold.millisecs(5);    // -> 😭 Holds for 5ms
    await hold.seconds(30);     // -> 😞 Holds for 30s
    await hold.minutes(10);     // -> 😦 Holds for 10min
    await hold.hours(2);        // -> 😄 Holds for 2hrs

    console.log('🚌💨 leaving...');
}

Function Type Definitions

/**
 * @param ms The amount of milliseconds to wait.
 * @return A promise that gets resolved after a given amount of milliseconds.
 */
function millisecs(ms: number): Promise<void>;

/**
 * @param s The amount of seconds to wait.
 * @return A promise that gets resolved after a given amount of seconds.
 */
function seconds(s: number): Promise<void>;

/**
 * @param min The amount of minutes to wait.
 * @return A promise that gets resolved after a given amount of minutes.
 */
function minutes(min: number): Promise<void>;

/**
 * @param hr The amount of hours to wait.
 * @return A promise that gets resolved after a given amount of hours.
 */
function hours(hr: number): Promise<void>;

License

Hold.js is licensed under the MIT License.

Package Sidebar

Install

npm i holddotjs

Weekly Downloads

4

Version

1.1.1

License

MIT

Unpacked Size

4.23 kB

Total Files

4

Last publish

Collaborators

  • andresromeroh