Skip to content

Commit

Permalink
#119 jsdoc for the events
Browse files Browse the repository at this point in the history
  • Loading branch information
agsh committed Oct 29, 2019
1 parent 01af8c1 commit f9eb195
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/cam.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ Cam.prototype.connect = function(callback) {
} else {
if (!--count) {
this.getActiveSources();
/**
* Indicates that device is connected.
* @event Cam#connect
*/
this.emit('connect');
if (callback) {
return callback.call(this, err);
Expand Down Expand Up @@ -234,6 +238,11 @@ Cam.prototype._request = function(options, callback) {
callback(err);
}
});
/**
* Indicates raw xml request to device.
* @event Cam#rawRequest
* @type {Object}
*/
this.emit('rawRequest', options.body);
req.write(options.body);
req.end();
Expand Down Expand Up @@ -597,6 +606,11 @@ Cam.prototype.getActiveSources = function() {

// If we haven't got any active source, send a warning
if (this.activeSources.length === 0) {
/**
* Indicates any warning.
* @event Cam#rawResponse
* @type {string}
*/
this.emit('warning', 'There are no active sources at this device');
}
};
Expand Down

0 comments on commit f9eb195

Please sign in to comment.