From 05179422535f6b37f12fe9a134d80e48ed6eba23 Mon Sep 17 00:00:00 2001 From: Andrew Stewart Date: Tue, 10 Jun 2014 09:20:23 -0700 Subject: [PATCH] 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. --- lib/adaptor.js | 5 ++--- lib/driver.js | 4 +--- test/specs/adaptor.spec.js | 6 ------ test/specs/driver.spec.js | 4 ---- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/lib/adaptor.js b/lib/adaptor.js index b50d317..1d6f5a0 100644 --- a/lib/adaptor.js +++ b/lib/adaptor.js @@ -44,8 +44,8 @@ Adaptor.prototype.commands = function() { return this.commandList; }; -// Public: Connects to the adaptor, and emits 'connect' from the @connection -// when done. +// Public: Connects to the adaptor, and triggers the provided callback when +// done. // // callback - function to run when the adaptor is connected // @@ -53,7 +53,6 @@ Adaptor.prototype.commands = function() { Adaptor.prototype.connect = function(callback) { Logger.info("Connecting to adaptor '" + this.name + "'..."); callback(null); - return this.connection.emit('connect'); }; // Public: Disconnects from the adaptor diff --git a/lib/driver.js b/lib/driver.js index 2172c88..1060aba 100644 --- a/lib/driver.js +++ b/lib/driver.js @@ -45,8 +45,7 @@ Driver.prototype.commands = function() { return this.commandList; }; -// Public: Starts up the driver, and emits 'connect' from the @device -// when done. +// Public: Starts up the driver, and triggers the provided callback when done. // // callback - function to run when the driver is started // @@ -54,7 +53,6 @@ Driver.prototype.commands = function() { Driver.prototype.start = function(callback) { Logger.info("Driver " + this.name + " started"); callback(null); - this.device.emit('start'); return true; }; diff --git a/test/specs/adaptor.spec.js b/test/specs/adaptor.spec.js index ff1a2c1..735cce7 100644 --- a/test/specs/adaptor.spec.js +++ b/test/specs/adaptor.spec.js @@ -47,13 +47,11 @@ describe("Adaptor", function() { var callback = spy(); before(function() { - stub(connection, 'emit'); stub(Logger, 'info'); adaptor.connect(callback); }); after(function() { - connection.emit.restore(); Logger.info.restore(); }); @@ -65,10 +63,6 @@ describe("Adaptor", function() { it("triggers the provided callback", function() { 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() { diff --git a/test/specs/driver.spec.js b/test/specs/driver.spec.js index 22b1825..98c0f32 100644 --- a/test/specs/driver.spec.js +++ b/test/specs/driver.spec.js @@ -74,10 +74,6 @@ describe("Driver", function() { it("triggers the provided callback", function() { 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() {