Emit attach event any case

This commit is contained in:
Leo Bonnargent 2019-11-20 14:42:23 +01:00
parent 2482422302
commit 55bcafa637

View File

@ -269,6 +269,7 @@ export class Hub extends EventEmitter {
port.type = type;
if (this.autoSubscribe) {
this._activatePortDevice(port.value, type, this._getModeForDeviceType(type), 0x00);
}
/**
* Emits when a motor or sensor is attached to the Hub.
* @event Hub#attach
@ -276,7 +277,6 @@ export class Hub extends EventEmitter {
* @param {DeviceType} type
*/
this.emit("attach", port.id, type);
}
} else {
port.type = Consts.DeviceType.UNKNOWN;
debug(`Port ${port.id} disconnected`);