Refactor connection & device to pure JS style

This commit is contained in:
deadprogram 2014-02-27 10:33:43 -08:00
parent 04a32e522f
commit 30228c7f3c
2 changed files with 131 additions and 152 deletions

View File

@ -2,31 +2,22 @@
* connection
* cylonjs.com
*
* Copyright (c) 2013 The Hybrid Group
* Copyright (c) 2013-2014 The Hybrid Group
* Licensed under the Apache 2.0 license.
*/
'use strict';
(function() {
'use strict';
var EventEmitter, namespace,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
require("./robot");
require("./port");
require("./adaptor");
var namespace = require('node-namespace');
var EventEmitter = require('events').EventEmitter;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }
require("./robot");
require("./port");
require("./adaptor");
namespace = require('node-namespace');
EventEmitter = require('events').EventEmitter;
namespace('Cylon', function() {
return this.Connection = (function(_super) {
__extends(Connection, _super);
namespace("Cylon", function() {
this.Connection = (function(klass) {
subclass(Connection, klass);
function Connection(opts) {
if (opts == null) {
@ -82,8 +73,6 @@
return Connection;
})(EventEmitter);
});
});
module.exports = Cylon.Connection;
}).call(this);
module.exports = Cylon.Connection;

View File

@ -2,29 +2,21 @@
* device
* cylonjs.com
*
* Copyright (c) 2013 The Hybrid Group
* Copyright (c) 2013-2014 The Hybrid Group
* Licensed under the Apache 2.0 license.
*/
'use strict';
(function() {
'use strict';
var EventEmitter, namespace,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
require('./cylon');
require('./driver');
var namespace = require('node-namespace');
var EventEmitter = require('events').EventEmitter;
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }
require('./cylon');
require('./driver');
namespace = require('node-namespace');
EventEmitter = require('events').EventEmitter;
namespace('Cylon', function() {
return this.Device = (function(_super) {
__extends(Device, _super);
namespace("Cylon", function() {
this.Device = (function(klass) {
subclass(Device, klass);
function Device(opts) {
if (opts == null) {
@ -94,8 +86,6 @@
return Device;
})(EventEmitter);
});
});
module.exports = Cylon.Device;
}).call(this);
module.exports = Cylon.Device;