Remove the 'connect' and 'start' events

These events are being removed, as they're essentially useless in most cases, as
the events will already have been emitted before the work block is run to set up
handlers for them.
This commit is contained in:
Andrew Stewart 2014-06-10 09:20:23 -07:00
parent b1d7dd8186
commit 0517942253
4 changed files with 3 additions and 16 deletions

View File

@ -44,8 +44,8 @@ Adaptor.prototype.commands = function() {
return this.commandList; return this.commandList;
}; };
// Public: Connects to the adaptor, and emits 'connect' from the @connection // Public: Connects to the adaptor, and triggers the provided callback when
// when done. // done.
// //
// callback - function to run when the adaptor is connected // callback - function to run when the adaptor is connected
// //
@ -53,7 +53,6 @@ Adaptor.prototype.commands = function() {
Adaptor.prototype.connect = function(callback) { Adaptor.prototype.connect = function(callback) {
Logger.info("Connecting to adaptor '" + this.name + "'..."); Logger.info("Connecting to adaptor '" + this.name + "'...");
callback(null); callback(null);
return this.connection.emit('connect');
}; };
// Public: Disconnects from the adaptor // Public: Disconnects from the adaptor

View File

@ -45,8 +45,7 @@ Driver.prototype.commands = function() {
return this.commandList; return this.commandList;
}; };
// Public: Starts up the driver, and emits 'connect' from the @device // Public: Starts up the driver, and triggers the provided callback when done.
// when done.
// //
// callback - function to run when the driver is started // callback - function to run when the driver is started
// //
@ -54,7 +53,6 @@ Driver.prototype.commands = function() {
Driver.prototype.start = function(callback) { Driver.prototype.start = function(callback) {
Logger.info("Driver " + this.name + " started"); Logger.info("Driver " + this.name + " started");
callback(null); callback(null);
this.device.emit('start');
return true; return true;
}; };

View File

@ -47,13 +47,11 @@ describe("Adaptor", function() {
var callback = spy(); var callback = spy();
before(function() { before(function() {
stub(connection, 'emit');
stub(Logger, 'info'); stub(Logger, 'info');
adaptor.connect(callback); adaptor.connect(callback);
}); });
after(function() { after(function() {
connection.emit.restore();
Logger.info.restore(); Logger.info.restore();
}); });
@ -65,10 +63,6 @@ describe("Adaptor", function() {
it("triggers the provided callback", function() { it("triggers the provided callback", function() {
expect(callback).to.be.called; expect(callback).to.be.called;
}); });
it("tells the connection to emit the 'connect' event", function() {
expect(connection.emit).to.be.calledWith('connect');
});
}); });
describe("#disconnect", function() { describe("#disconnect", function() {

View File

@ -74,10 +74,6 @@ describe("Driver", function() {
it("triggers the provided callback", function() { it("triggers the provided callback", function() {
expect(callback).to.be.called; expect(callback).to.be.called;
}); });
it("tells the device to emit the 'start' event", function() {
expect(device.emit).to.be.calledWith('start');
});
}); });
describe("#halt", function() { describe("#halt", function() {