Removing DriverName param in favor of opts, which already contains it.

This commit is contained in:
Edgar O Silva 2013-10-29 18:15:41 -06:00
parent 2e0d0423bb
commit cf6d2c88bc
2 changed files with 8 additions and 8 deletions

8
dist/device.js vendored
View File

@ -35,7 +35,7 @@
this.name = opts.name;
this.pin = opts.pin;
this.connection = this.determineConnection(opts.connection) || this.defaultConnection();
this.driver = this.requireDriver(opts.driver, opts);
this.driver = this.requireDriver(opts);
proxyFunctionsToObject(this.driver.commands(), this.driver, klass);
}
@ -66,12 +66,12 @@
return first;
};
Device.prototype.requireDriver = function(driverName, opts) {
Device.prototype.requireDriver = function(opts) {
if (opts == null) {
opts = {};
}
Logger.debug("Loading driver '" + driverName + "'");
return this.robot.requireDriver(driverName, this.self, opts);
Logger.debug("Loading driver '" + opts.driver + "'");
return this.robot.requireDriver(opts.driver, this.self, opts);
};
return Device;

View File

@ -20,7 +20,7 @@ module.exports = class Device extends EventEmitter
@name = opts.name
@pin = opts.pin
@connection = @determineConnection(opts.connection) or @defaultConnection()
@driver = @requireDriver(opts.driver, opts)
@driver = @requireDriver(opts)
proxyFunctionsToObject @driver.commands(), @driver, klass
start: (callback) =>
@ -38,6 +38,6 @@ module.exports = class Device extends EventEmitter
first or= v
first
requireDriver: (driverName, opts = {}) ->
Logger.debug "Loading driver '#{driverName}'"
@robot.requireDriver(driverName, @self, opts)
requireDriver: (opts = {}) ->
Logger.debug "Loading driver '#{ opts.driver }'"
@robot.requireDriver(opts.driver, @self, opts)