on-ready
v0.1.0
Published
Ready event helper
Downloads
11
Readme
on-ready
Wait for a list of readyable objects to be ready. Objects used must have two qualifications:
- has an
on
method - emits a
ready
event - 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() {
// ...
})