on-ready

0.1.0 • Public • Published

on-ready

Wait for a list of readyable objects to be ready. Objects used must have two qualifications:

  1. has an on method
  2. emits a ready event
  3. has or can have a ready boolean flag to note if ready

Install

With npm

npm install on-ready

Usage

Node.js

var onReady = require('on-ready')
 
// use on some redis clients
var redis = require('redis')
  , client1 = redis.createClient()
  , client2 = redis.createClient()
 
onReady([client1, client2], function(err) {
  // ...
 
  client1.ready // true
  client2.ready // true
})
 
// can call using arguments
onReady(client1, client2, function() { 
  // ...
})
 
// repeated calls still work fine
onReady([client1], [client2], function() { 
  // ...
})

Readme

Keywords

Package Sidebar

Install

npm i on-ready

Weekly Downloads

2

Version

0.1.0

License

MIT

Last publish

Collaborators

  • sorensen