You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
478 B
27 lines
478 B
var util = require('util')
|
|
var events = require('events')
|
|
|
|
var waitFor = function() {
|
|
events.EventEmitter.call(this)
|
|
}
|
|
|
|
util.inherits(waitFor, events.EventEmitter)
|
|
|
|
waitFor.prototype.command = function(ms, cb) {
|
|
var self = this
|
|
|
|
ms = ms || 1000
|
|
|
|
setTimeout(function() {
|
|
// if we have a callback, call it right before the complete event
|
|
if (cb) {
|
|
cb.call(self.client.api)
|
|
}
|
|
|
|
self.emit('complete')
|
|
}, ms)
|
|
|
|
return this
|
|
}
|
|
|
|
module.exports = waitFor
|
|
|