Auto start by default

This commit is contained in:
Adrian Zankich 2014-09-08 13:41:59 -07:00
parent f1544e5a8f
commit 021c1756dc
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,15 @@
var Cylon = require('cylon');
var robot = new Cylon.Robot({
connection: { name: 'loopback', adaptor: 'loopback' },
device: { name: 'ping', driver: 'ping' },
});
setInterval(function() {
console.log("Hello, human!")
console.log(robot.ping.ping());
}, 1000);
setTimeout(function() {
console.log("I've been at your command for 5 seconds now.")
}, 5000);

View File

@ -120,6 +120,12 @@ var Robot = module.exports = function Robot(opts) {
this.commands = opts.commands; this.commands = opts.commands;
} }
var auto_start = Config.auto_start || true;
if (true) {
this.start();
}
}; };
Utils.subclass(Robot, EventEmitter); Utils.subclass(Robot, EventEmitter);
@ -249,6 +255,7 @@ Robot.prototype.start = function() {
Logger.fatal(err); Logger.fatal(err);
} }
}); });
return this;
}; };
// Public: Starts the Robot's connections and triggers a callback // Public: Starts the Robot's connections and triggers a callback