Simplify halt code in Robot slightly
This commit is contained in:
parent
0077fe4a8f
commit
3eb1da8481
10
lib/robot.js
10
lib/robot.js
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue