cylon/lib/test/ping.js

33 lines
581 B
JavaScript
Raw Permalink Normal View History

2014-12-16 03:15:29 +08:00
"use strict";
2014-02-27 22:44:53 +08:00
2014-12-16 03:15:29 +08:00
var Driver = require("../driver"),
Utils = require("../utils");
2014-05-07 09:24:43 +08:00
2014-08-06 09:41:57 +08:00
var Ping = module.exports = function Ping() {
Ping.__super__.constructor.apply(this, arguments);
2014-08-06 09:41:57 +08:00
this.commands = {
2014-08-12 06:29:35 +08:00
ping: this.ping
2014-08-06 09:41:57 +08:00
};
this.events = ["ping"];
};
2014-02-27 22:44:53 +08:00
Utils.subclass(Ping, Driver);
2014-02-27 22:44:53 +08:00
Ping.prototype.ping = function() {
2014-12-16 03:15:29 +08:00
this.emit("ping", "ping");
return "pong";
};
2014-02-27 22:44:53 +08:00
Ping.prototype.start = function(callback) {
callback();
};
Ping.prototype.halt = function(callback) {
callback();
};
2014-12-16 03:15:29 +08:00
Ping.drivers = ["ping"];
Ping.driver = function(opts) { return new Ping(opts); };