Comparing version 0.1.0 to 0.2.0
@@ -79,6 +79,6 @@ | ||
if (err) { | ||
throw new Error('Failed to initialize queue'); | ||
debug('Failed to initialize queue', err); | ||
throw new Error(err); | ||
} | ||
// initialize queue | ||
@@ -90,3 +90,2 @@ self.init(res); | ||
self.emit('connected'); | ||
self.pull(); | ||
} | ||
@@ -106,5 +105,31 @@ ); | ||
}, this.onMessage.bind(this)); | ||
}; | ||
/** | ||
* Start consuming the queue. | ||
* | ||
* @api public | ||
*/ | ||
Queue.prototype.start = function() { | ||
if (this._started) { | ||
return; | ||
} | ||
this._started = true; | ||
this.pull(); | ||
}; | ||
/** | ||
* Check wether the queue is started or not | ||
* | ||
* @api public | ||
*/ | ||
Queue.prototype.isStarted = function() { | ||
return !!this._started; | ||
}; | ||
/** | ||
* Handler for message received | ||
@@ -174,3 +199,2 @@ * | ||
//var provider = new Provider(creds.id, creds.secret); | ||
// | ||
//var queue = provider.get('dev-notifications'); | ||
@@ -193,2 +217,2 @@ // | ||
//queue.connect(); | ||
// |
{ | ||
"name": "queues", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Collection of queue wrappers with a common interface.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
8071
279