@f/sleep

1.0.0 • Public • Published

sleep

Build status Git tag NPM version Code style

Sleep for n milliseconds

Installation

$ npm install @f/sleep

Usage

This is particularly useful when programming with generators, e.g.

var sleep = require('@f/sleep')

function * pollThing () {
  while (!thingIsReady()) {
    yield sleep(100)
  }
}

API

sleep(timeInMs)

  • timeInMs - The time in milliseconds you want to sleep for

Returns: A promise that resolves in timeInMs milliseconds.

License

MIT

/@f/sleep/

    Package Sidebar

    Install

    npm i @f/sleep

    Weekly Downloads

    11

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • f