Default to no-op callbacks for #halt methods

This commit is contained in:
Andrew Stewart 2014-09-04 11:14:47 -07:00
parent d2b00c7d30
commit 48497b7b0e
2 changed files with 3 additions and 0 deletions

View File

@ -105,6 +105,7 @@ Cylon.config = function(key) {
// //
// Returns nothing // Returns nothing
Cylon.halt = function halt(callback) { Cylon.halt = function halt(callback) {
callback = callback || function() {}
// if robots can't shut down quickly enough, forcefully self-terminate // if robots can't shut down quickly enough, forcefully self-terminate
var timeout = Config.halt_timeout || 3000 var timeout = Config.halt_timeout || 3000
Utils.after(timeout, callback); Utils.after(timeout, callback);

View File

@ -285,6 +285,8 @@ Robot.prototype.startDevices = function(callback) {
// //
// Returns nothing // Returns nothing
Robot.prototype.halt = function(callback) { Robot.prototype.halt = function(callback) {
callback = callback || function() {};
var fns = []; var fns = [];
for (var d in this.devices) { for (var d in this.devices) {