npm.io
1.0.0 • Published 10 years ago

@f/sleep

Licence
MIT
Version
1.0.0
Deps
0
Vulns
0
Weekly
0

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