2013-10-26 04:11:09 +08:00
|
|
|
/*
|
|
|
|
* Ping driver
|
|
|
|
* cylonjs.com
|
|
|
|
*
|
|
|
|
* Copyright (c) 2013 The Hybrid Group
|
|
|
|
* Licensed under the Apache 2.0 license.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
|
'use strict';
|
2013-12-15 03:54:56 +08:00
|
|
|
var namespace,
|
|
|
|
__slice = [].slice,
|
|
|
|
__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; };
|
|
|
|
|
|
|
|
namespace = require('node-namespace');
|
2013-10-26 04:11:09 +08:00
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
driver: function() {
|
|
|
|
var args;
|
|
|
|
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
|
|
|
|
return (function(func, args, ctor) {
|
|
|
|
ctor.prototype = func.prototype;
|
|
|
|
var child = new ctor, result = func.apply(child, args);
|
|
|
|
return Object(result) === result ? result : child;
|
2013-12-15 03:54:56 +08:00
|
|
|
})(Cylon.Drivers.Ping, args, function(){});
|
2013-10-26 04:11:09 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2013-12-15 03:54:56 +08:00
|
|
|
namespace('Cylon.Drivers', function() {
|
2013-12-16 11:28:12 +08:00
|
|
|
var _ref;
|
2013-12-15 03:54:56 +08:00
|
|
|
return this.Ping = (function(_super) {
|
|
|
|
__extends(Ping, _super);
|
|
|
|
|
2013-12-16 11:28:12 +08:00
|
|
|
function Ping() {
|
|
|
|
_ref = Ping.__super__.constructor.apply(this, arguments);
|
|
|
|
return _ref;
|
2013-10-26 04:11:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
Ping.prototype.commands = function() {
|
|
|
|
return ['ping'];
|
|
|
|
};
|
|
|
|
|
|
|
|
Ping.prototype.ping = function() {
|
|
|
|
return "pong";
|
|
|
|
};
|
|
|
|
|
|
|
|
return Ping;
|
|
|
|
|
2013-12-16 15:08:34 +08:00
|
|
|
})(Cylon.Driver);
|
2013-12-15 03:54:56 +08:00
|
|
|
});
|
2013-10-26 04:11:09 +08:00
|
|
|
|
|
|
|
}).call(this);
|