cylon/examples/halt/halt.js

28 lines
478 B
JavaScript
Raw Normal View History

2014-12-14 08:19:25 +08:00
"use strict";
var Cylon = require("../..");
2014-09-05 02:47:40 +08:00
Cylon.robot({
2014-11-26 08:01:31 +08:00
connections: {
2014-12-14 08:19:25 +08:00
loopback: { adaptor: "loopback" }
2014-11-26 08:01:31 +08:00
},
devices: {
2014-12-14 08:19:25 +08:00
ping: { driver: "ping" }
2014-11-26 08:01:31 +08:00
},
2014-09-05 02:47:40 +08:00
2014-12-14 08:19:25 +08:00
work: function() {
2014-09-05 02:47:40 +08:00
after((1).second(), function() {
console.log("Hello human!");
console.log("I'm going to automatically stop in a few seconds.");
});
after((5).seconds(), function() {
console.log("I'm shutting down now.");
Cylon.halt();
});
}
});
Cylon.start();