cylon/examples/hello/fluent-hello.js

25 lines
536 B
JavaScript
Raw Permalink Normal View History

2014-12-14 08:19:25 +08:00
"use strict";
var Cylon = require("../..");
2014-11-26 08:01:31 +08:00
// ensure you install the API plugin first:
// $ npm install cylon-api-http
2014-11-26 08:01:31 +08:00
Cylon.api();
Cylon
2014-12-14 08:19:25 +08:00
.robot({ name: "test" })
.connection("loopback", { adaptor: "loopback" })
.device("ping", { driver: "ping" })
.on("ready", function(bot) {
2014-11-26 08:01:31 +08:00
setInterval(function() {
2014-12-14 08:19:25 +08:00
console.log("Hello, human!");
2014-11-26 08:01:31 +08:00
console.log(bot.ping.ping());
}, 1000);
setTimeout(function() {
2014-12-14 08:19:25 +08:00
console.log("I've been at your command for 5 seconds now.");
2014-11-26 08:01:31 +08:00
}, 5000);
});
Cylon.start();