Misc. cleanup in Basestar

This commit is contained in:
Andrew Stewart 2014-06-10 18:44:40 -07:00
parent 9c60700c0f
commit f797cf4c48
2 changed files with 12 additions and 17 deletions

View File

@ -17,11 +17,8 @@ var Utils = require('./utils');
//
// It also extends EventEmitter, so child classes are capable of emitting events
// for other parts of the system to handle.
var Basestar;
module.exports = Basestar = function Basestar(opts) {
this.self = this;
}
var Basestar = module.exports = function Basestar() {
};
Utils.subclass(Basestar, EventEmitter);
@ -34,7 +31,10 @@ Utils.subclass(Basestar, EventEmitter);
//
// Returns the klass where the methods have been proxied
Basestar.prototype.proxyMethods = function(methods, target, source, force) {
if (force == null) { force = false; }
if (force == null) {
force = false;
}
return Utils.proxyFunctionsToObject(methods, target, source, force);
};
@ -50,8 +50,6 @@ Basestar.prototype.proxyMethods = function(methods, target, source, force) {
//
// Returns the source
Basestar.prototype.defineEvent = function(opts) {
var self = this;
opts.sendUpdate = opts.sendUpdate || false;
opts.targetEventName = opts.targetEventName || opts.eventName;
@ -77,7 +75,9 @@ Basestar.prototype.defineEvent = function(opts) {
//
// Returns this.connector
Basestar.prototype.defineAdaptorEvent = function(opts) {
if (typeof opts === 'string') { opts = { eventName: opts }; }
if (typeof opts === 'string') {
opts = { eventName: opts };
}
opts['source'] = this.connector;
opts['target'] = this.connection;
@ -93,7 +93,9 @@ Basestar.prototype.defineAdaptorEvent = function(opts) {
//
// Returns this.connection
Basestar.prototype.defineDriverEvent = function(opts) {
if (typeof opts === 'string') { opts = { eventName: opts }; }
if (typeof opts === 'string') {
opts = { eventName: opts };
}
opts['source'] = this.connection;
opts['target'] = this.device;

View File

@ -6,13 +6,6 @@ var Basestar = source('basestar'),
var EventEmitter = require('events').EventEmitter;
describe('Basestar', function() {
describe('constructor', function() {
it('assigns @self to the instance of the Basestar class', function() {
var instance = new Basestar();
expect(instance.self).to.be.eql(instance);
});
});
describe('#proxyMethods', function() {
var methods = ['asString', 'toString', 'returnString'];