Simplify halt code in Robot slightly

This commit is contained in:
Andrew Stewart 2014-11-30 11:47:33 -08:00
parent 0077fe4a8f
commit 3eb1da8481
1 changed files with 2 additions and 8 deletions

View File

@ -393,19 +393,13 @@ Robot.prototype.halt = function(callback) {
var fns = Object.keys(this.devices).map(function(d) {
var device = this.devices[d];
return function(callback) {
device.halt.call(device, callback);
};
return device.halt.bind(device);
}.bind(this));
Async.parallel(fns, function() {
var fns = Object.keys(this.connections).map(function(c) {
var connection = this.connections[c];
return function(callback) {
connection.disconnect.call(connection, callback);
};
return connection.disconnect.bind(connection);
}.bind(this));
Async.parallel(fns, callback);