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 fns = Object.keys(this.devices).map(function(d) {
|
||||||
var device = this.devices[d];
|
var device = this.devices[d];
|
||||||
|
return device.halt.bind(device);
|
||||||
return function(callback) {
|
|
||||||
device.halt.call(device, callback);
|
|
||||||
};
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
Async.parallel(fns, function() {
|
Async.parallel(fns, function() {
|
||||||
var fns = Object.keys(this.connections).map(function(c) {
|
var fns = Object.keys(this.connections).map(function(c) {
|
||||||
var connection = this.connections[c];
|
var connection = this.connections[c];
|
||||||
|
return connection.disconnect.bind(connection);
|
||||||
return function(callback) {
|
|
||||||
connection.disconnect.call(connection, callback);
|
|
||||||
};
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|
||||||
Async.parallel(fns, callback);
|
Async.parallel(fns, callback);
|
||||||
|
|
Loading…
Reference in New Issue