From 55bcafa637b86a009c883b2c9bd0bb4788efdf38 Mon Sep 17 00:00:00 2001 From: Leo Bonnargent Date: Wed, 20 Nov 2019 14:42:23 +0100 Subject: [PATCH] Emit attach event any case --- src/hub.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hub.ts b/src/hub.ts index 684fd5c..9418b80 100644 --- a/src/hub.ts +++ b/src/hub.ts @@ -269,14 +269,14 @@ 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 - * @param {string} port - * @param {DeviceType} type - */ - this.emit("attach", port.id, type); } + /** + * Emits when a motor or sensor is attached to the Hub. + * @event Hub#attach + * @param {string} port + * @param {DeviceType} type + */ + this.emit("attach", port.id, type); } else { port.type = Consts.DeviceType.UNKNOWN; debug(`Port ${port.id} disconnected`);