usb 2.9.0 → 2.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +6 -0
  3. package/binding.gyp +1 -1
  4. package/dist/index.js +35 -113
  5. package/dist/index.js.map +1 -1
  6. package/dist/usb/bindings.js +2 -2
  7. package/dist/usb/bindings.js.map +1 -1
  8. package/dist/usb/capability.js +3 -4
  9. package/dist/usb/capability.js.map +1 -1
  10. package/dist/usb/device.js +101 -123
  11. package/dist/usb/device.js.map +1 -1
  12. package/dist/usb/endpoint.d.ts +2 -1
  13. package/dist/usb/endpoint.js +74 -98
  14. package/dist/usb/endpoint.js.map +1 -1
  15. package/dist/usb/index.js +26 -59
  16. package/dist/usb/index.js.map +1 -1
  17. package/dist/usb/interface.js +41 -44
  18. package/dist/usb/interface.js.map +1 -1
  19. package/dist/webusb/index.js +169 -355
  20. package/dist/webusb/index.js.map +1 -1
  21. package/dist/webusb/webusb-device.js +367 -751
  22. package/dist/webusb/webusb-device.js.map +1 -1
  23. package/package.json +5 -5
  24. package/prebuilds/android-arm/node.napi.armv7.node +0 -0
  25. package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
  26. package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
  27. package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
  28. package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
  29. package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
  30. package/prebuilds/linux-ia32/node.napi.node +0 -0
  31. package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
  32. package/prebuilds/linux-x64/node.napi.musl.node +0 -0
  33. package/prebuilds/win32-ia32/node.napi.node +0 -0
  34. package/prebuilds/win32-x64/node.napi.node +0 -0
  35. package/src/device.cc +5 -3
  36. package/test/usb.coffee +25 -4
  37. package/test/worker.cjs +5 -1
@@ -1,41 +1,24 @@
1
1
  "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
2
  Object.defineProperty(exports, "__esModule", { value: true });
18
3
  exports.OutEndpoint = exports.InEndpoint = exports.Endpoint = void 0;
19
- var events_1 = require("events");
20
- var bindings_1 = require("./bindings");
21
- var isBuffer = function (obj) { return obj && obj instanceof Uint8Array; };
4
+ const events_1 = require("events");
5
+ const bindings_1 = require("./bindings");
6
+ const isBuffer = (obj) => obj && obj instanceof Uint8Array;
22
7
  /** Common base for InEndpoint and OutEndpoint. */
23
- var Endpoint = /** @class */ (function (_super) {
24
- __extends(Endpoint, _super);
25
- function Endpoint(device, descriptor) {
26
- var _this = _super.call(this) || this;
27
- _this.device = device;
8
+ class Endpoint extends events_1.EventEmitter {
9
+ constructor(device, descriptor) {
10
+ super();
11
+ this.device = device;
28
12
  /** Sets the timeout in milliseconds for transfers on this endpoint. The default, `0`, is infinite timeout. */
29
- _this.timeout = 0;
30
- _this.descriptor = descriptor;
31
- _this.address = descriptor.bEndpointAddress;
32
- _this.transferType = descriptor.bmAttributes & 0x03;
33
- return _this;
13
+ this.timeout = 0;
14
+ this.descriptor = descriptor;
15
+ this.address = descriptor.bEndpointAddress;
16
+ this.transferType = descriptor.bmAttributes & 0x03;
34
17
  }
35
18
  /** Clear the halt/stall condition for this endpoint. */
36
- Endpoint.prototype.clearHalt = function (callback) {
19
+ clearHalt(callback) {
37
20
  return this.device.__clearHalt(this.address, callback);
38
- };
21
+ }
39
22
  /**
40
23
  * Create a new `Transfer` object for this endpoint.
41
24
  *
@@ -45,24 +28,21 @@ var Endpoint = /** @class */ (function (_super) {
45
28
  * @param timeout Timeout for the transfer (0 means unlimited).
46
29
  * @param callback Transfer completion callback.
47
30
  */
48
- Endpoint.prototype.makeTransfer = function (timeout, callback) {
31
+ makeTransfer(timeout, callback) {
49
32
  return new bindings_1.Transfer(this.device, this.address, this.transferType, timeout, callback);
50
- };
51
- return Endpoint;
52
- }(events_1.EventEmitter));
33
+ }
34
+ }
53
35
  exports.Endpoint = Endpoint;
54
36
  /** Endpoints in the IN direction (device->PC) have this type. */
55
- var InEndpoint = /** @class */ (function (_super) {
56
- __extends(InEndpoint, _super);
57
- function InEndpoint(device, descriptor) {
58
- var _this = _super.call(this, device, descriptor) || this;
37
+ class InEndpoint extends Endpoint {
38
+ constructor(device, descriptor) {
39
+ super(device, descriptor);
59
40
  /** Endpoint direction. */
60
- _this.direction = 'in';
61
- _this.pollTransfers = [];
62
- _this.pollTransferSize = 0;
63
- _this.pollPending = 0;
64
- _this.pollActive = false;
65
- return _this;
41
+ this.direction = 'in';
42
+ this.pollTransfers = [];
43
+ this.pollTransferSize = 0;
44
+ this.pollPending = 0;
45
+ this.pollActive = false;
66
46
  }
67
47
  /**
68
48
  * Perform a transfer to read data from the endpoint.
@@ -75,20 +55,19 @@ var InEndpoint = /** @class */ (function (_super) {
75
55
  * @param length
76
56
  * @param callback
77
57
  */
78
- InEndpoint.prototype.transfer = function (length, callback) {
79
- var _this = this;
80
- var buffer = Buffer.alloc(length);
81
- var cb = function (error, _buffer, actualLength) {
82
- callback.call(_this, error, buffer.slice(0, actualLength));
58
+ transfer(length, callback) {
59
+ const buffer = Buffer.alloc(length);
60
+ const cb = (error, _buffer, actualLength) => {
61
+ callback.call(this, error, buffer.slice(0, actualLength));
83
62
  };
84
63
  try {
85
64
  this.makeTransfer(this.timeout, cb).submit(buffer);
86
65
  }
87
66
  catch (e) {
88
- process.nextTick(function () { return callback.call(_this, e); });
67
+ process.nextTick(() => callback.call(this, e));
89
68
  }
90
69
  return this;
91
- };
70
+ }
92
71
  /**
93
72
  * Start polling the endpoint.
94
73
  *
@@ -98,40 +77,44 @@ var InEndpoint = /** @class */ (function (_super) {
98
77
  * The device must be open to use this method.
99
78
  * @param nTransfers
100
79
  * @param transferSize
80
+ * @param callback
101
81
  */
102
- InEndpoint.prototype.startPoll = function (nTransfers, transferSize, _callback) {
103
- var _this = this;
104
- var transferDone = function (error, transfer, buffer, actualLength) {
82
+ startPoll(nTransfers, transferSize, callback) {
83
+ const transferDone = (error, transfer, buffer, actualLength) => {
105
84
  if (!error) {
106
- _this.emit('data', buffer.slice(0, actualLength));
85
+ this.emit('data', buffer.slice(0, actualLength));
107
86
  }
108
- else if (error.errno != bindings_1.LIBUSB_TRANSFER_CANCELLED) {
109
- _this.emit('error', error);
110
- if (_this.pollActive) {
111
- _this.stopPoll();
87
+ else if (error.errno !== bindings_1.LIBUSB_TRANSFER_CANCELLED) {
88
+ if (this.pollActive) {
89
+ this.emit('error', error);
90
+ this.stopPoll();
112
91
  }
113
92
  }
114
- if (_this.pollActive) {
93
+ if (this.pollActive) {
115
94
  startTransfer(transfer);
116
95
  }
117
96
  else {
118
- _this.pollPending--;
119
- if (_this.pollPending === 0) {
120
- _this.pollTransfers = [];
121
- _this.pollActive = false;
122
- _this.emit('end');
97
+ this.pollPending--;
98
+ if (this.pollPending === 0) {
99
+ this.pollTransfers = [];
100
+ this.pollActive = false;
101
+ this.emit('end');
102
+ if (callback) {
103
+ const cancelled = (error === null || error === void 0 ? void 0 : error.errno) === bindings_1.LIBUSB_TRANSFER_CANCELLED;
104
+ callback(cancelled ? undefined : error, buffer, actualLength, cancelled);
105
+ }
123
106
  }
124
107
  }
125
108
  };
126
- var startTransfer = function (transfer) {
109
+ const startTransfer = (transfer) => {
127
110
  try {
128
- transfer.submit(Buffer.alloc(_this.pollTransferSize), function (error, buffer, actualLength) {
111
+ transfer.submit(Buffer.alloc(this.pollTransferSize), (error, buffer, actualLength) => {
129
112
  transferDone(error, transfer, buffer, actualLength);
130
113
  });
131
114
  }
132
115
  catch (e) {
133
- _this.emit('error', e);
134
- _this.stopPoll();
116
+ this.emit('error', e);
117
+ this.stopPoll();
135
118
  }
136
119
  };
137
120
  this.pollTransfers = this.startPollTransfers(nTransfers, transferSize, function (error, buffer, actualLength) {
@@ -140,23 +123,21 @@ var InEndpoint = /** @class */ (function (_super) {
140
123
  this.pollTransfers.forEach(startTransfer);
141
124
  this.pollPending = this.pollTransfers.length;
142
125
  return this.pollTransfers;
143
- };
144
- InEndpoint.prototype.startPollTransfers = function (nTransfers, transferSize, callback) {
145
- if (nTransfers === void 0) { nTransfers = 3; }
146
- if (transferSize === void 0) { transferSize = this.descriptor.wMaxPacketSize; }
126
+ }
127
+ startPollTransfers(nTransfers = 3, transferSize = this.descriptor.wMaxPacketSize, callback) {
147
128
  if (this.pollActive) {
148
129
  throw new Error('Polling already active');
149
130
  }
150
131
  this.pollTransferSize = transferSize;
151
132
  this.pollActive = true;
152
133
  this.pollPending = 0;
153
- var transfers = [];
154
- for (var i = 0; i < nTransfers; i++) {
155
- var transfer = this.makeTransfer(0, callback);
134
+ const transfers = [];
135
+ for (let i = 0; i < nTransfers; i++) {
136
+ const transfer = this.makeTransfer(0, callback);
156
137
  transfers[i] = transfer;
157
138
  }
158
139
  return transfers;
159
- };
140
+ }
160
141
  /**
161
142
  * Stop polling.
162
143
  *
@@ -165,11 +146,11 @@ var InEndpoint = /** @class */ (function (_super) {
165
146
  * The device must be open to use this method.
166
147
  * @param callback
167
148
  */
168
- InEndpoint.prototype.stopPoll = function (callback) {
149
+ stopPoll(callback) {
169
150
  if (!this.pollActive) {
170
151
  throw new Error('Polling is not active.');
171
152
  }
172
- for (var i = 0; i < this.pollTransfers.length; i++) {
153
+ for (let i = 0; i < this.pollTransfers.length; i++) {
173
154
  try {
174
155
  this.pollTransfers[i].cancel();
175
156
  }
@@ -180,18 +161,15 @@ var InEndpoint = /** @class */ (function (_super) {
180
161
  this.pollActive = false;
181
162
  if (callback)
182
163
  this.once('end', callback);
183
- };
184
- return InEndpoint;
185
- }(Endpoint));
164
+ }
165
+ }
186
166
  exports.InEndpoint = InEndpoint;
187
167
  /** Endpoints in the OUT direction (PC->device) have this type. */
188
- var OutEndpoint = /** @class */ (function (_super) {
189
- __extends(OutEndpoint, _super);
190
- function OutEndpoint() {
191
- var _this = _super !== null && _super.apply(this, arguments) || this;
168
+ class OutEndpoint extends Endpoint {
169
+ constructor() {
170
+ super(...arguments);
192
171
  /** Endpoint direction. */
193
- _this.direction = 'out';
194
- return _this;
172
+ this.direction = 'out';
195
173
  }
196
174
  /**
197
175
  * Perform a transfer to write `data` to the endpoint.
@@ -204,28 +182,27 @@ var OutEndpoint = /** @class */ (function (_super) {
204
182
  * @param buffer
205
183
  * @param callback
206
184
  */
207
- OutEndpoint.prototype.transfer = function (buffer, callback) {
208
- var _this = this;
185
+ transfer(buffer, callback) {
209
186
  if (!buffer) {
210
187
  buffer = Buffer.alloc(0);
211
188
  }
212
189
  else if (!isBuffer(buffer)) {
213
190
  buffer = Buffer.from(buffer);
214
191
  }
215
- var cb = function (error, _buffer, actual) {
192
+ const cb = (error, _buffer, actual) => {
216
193
  if (callback) {
217
- callback.call(_this, error, actual || 0);
194
+ callback.call(this, error, actual || 0);
218
195
  }
219
196
  };
220
197
  try {
221
198
  this.makeTransfer(this.timeout, cb).submit(buffer);
222
199
  }
223
200
  catch (e) {
224
- process.nextTick(function () { return cb(e); });
201
+ process.nextTick(() => cb(e));
225
202
  }
226
203
  return this;
227
- };
228
- OutEndpoint.prototype.transferWithZLP = function (buffer, callback) {
204
+ }
205
+ transferWithZLP(buffer, callback) {
229
206
  if (buffer.length % this.descriptor.wMaxPacketSize === 0) {
230
207
  this.transfer(buffer);
231
208
  this.transfer(Buffer.alloc(0), callback);
@@ -233,8 +210,7 @@ var OutEndpoint = /** @class */ (function (_super) {
233
210
  else {
234
211
  this.transfer(buffer, callback);
235
212
  }
236
- };
237
- return OutEndpoint;
238
- }(Endpoint));
213
+ }
214
+ }
239
215
  exports.OutEndpoint = OutEndpoint;
240
216
  //# sourceMappingURL=endpoint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"endpoint.js","sourceRoot":"","sources":["../../tsc/usb/endpoint.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iCAAsC;AACtC,uCAA0F;AAG1F,IAAM,QAAQ,GAAG,UAAC,GAAyB,IAAwB,OAAA,GAAG,IAAI,GAAG,YAAY,UAAU,EAAhC,CAAgC,CAAC;AAEpG,kDAAkD;AAClD;IAAuC,4BAAY;IAe/C,kBAAsB,MAAc,EAAE,UAA8B;QAApE,YACI,iBAAO,SAIV;QALqB,YAAM,GAAN,MAAM,CAAQ;QANpC,8GAA8G;QACvG,aAAO,GAAG,CAAC,CAAC;QAOf,KAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,KAAI,CAAC,OAAO,GAAG,UAAU,CAAC,gBAAgB,CAAC;QAC3C,KAAI,CAAC,YAAY,GAAG,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC;;IACvD,CAAC;IAED,wDAAwD;IACjD,4BAAS,GAAhB,UAAiB,QAAsD;QACnE,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;OAQG;IACI,+BAAY,GAAnB,UAAoB,OAAe,EAAE,QAA4F;QAC7H,OAAO,IAAI,mBAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IACzF,CAAC;IACL,eAAC;AAAD,CAAC,AAvCD,CAAuC,qBAAY,GAuClD;AAvCqB,4BAAQ;AAyC9B,iEAAiE;AACjE;IAAgC,8BAAQ;IAUpC,oBAAY,MAAc,EAAE,UA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Ac,EAAE,QAAsD;QACzF,IAAI,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,cAAc,KAAK,CAAC,EAAE;YACtD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACtB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;SAC5C;aAAM;YACH,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;SACnC;IACL,CAAC;CACJ;AA9CD,kCA8CC"}
package/dist/usb/index.js CHANGED
@@ -1,18 +1,7 @@
1
1
  "use strict";
2
- var __values = (this && this.__values) || function(o) {
3
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
- if (m) return m.call(o);
5
- if (o && typeof o.length === "number") return {
6
- next: function () {
7
- if (o && i >= o.length) o = void 0;
8
- return { value: o && o[i++], done: !o };
9
- }
10
- };
11
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
- };
13
- var events_1 = require("events");
14
- var device_1 = require("./device");
15
- var usb = require("./bindings");
2
+ const events_1 = require("events");
3
+ const device_1 = require("./device");
4
+ const usb = require("./bindings");
16
5
  if (usb.INIT_ERROR) {
17
6
  /* eslint-disable no-console */
18
7
  console.warn('Failed to initialize libusb.');
@@ -26,54 +15,32 @@ Object.defineProperty(usb, 'pollHotplugDelay', {
26
15
  value: 500,
27
16
  writable: true
28
17
  });
29
- Object.getOwnPropertyNames(device_1.ExtendedDevice.prototype).forEach(function (name) {
18
+ Object.getOwnPropertyNames(device_1.ExtendedDevice.prototype).forEach(name => {
30
19
  Object.defineProperty(usb.Device.prototype, name, Object.getOwnPropertyDescriptor(device_1.ExtendedDevice.prototype, name) || Object.create(null));
31
20
  });
32
21
  // Devices delta support for non-libusb hotplug events
33
- var hotPlugDevices = new Set();
22
+ let hotPlugDevices = new Set();
34
23
  // This method needs to be used for attach/detach IDs (hotplugSupportType === 2) rather than a lookup because vid/pid are not unique
35
- var emitHotplugEvents = function () {
36
- var e_1, _a, e_2, _b;
24
+ const emitHotplugEvents = () => {
37
25
  // Collect current devices
38
- var devices = new Set(usb.getDeviceList());
39
- try {
40
- // Find attached devices
41
- for (var devices_1 = __values(devices), devices_1_1 = devices_1.next(); !devices_1_1.done; devices_1_1 = devices_1.next()) {
42
- var device = devices_1_1.value;
43
- if (!hotPlugDevices.has(device)) {
44
- usb.emit('attach', device);
45
- }
46
- }
47
- }
48
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
49
- finally {
50
- try {
51
- if (devices_1_1 && !devices_1_1.done && (_a = devices_1.return)) _a.call(devices_1);
52
- }
53
- finally { if (e_1) throw e_1.error; }
54
- }
55
- try {
56
- // Find detached devices
57
- for (var hotPlugDevices_1 = __values(hotPlugDevices), hotPlugDevices_1_1 = hotPlugDevices_1.next(); !hotPlugDevices_1_1.done; hotPlugDevices_1_1 = hotPlugDevices_1.next()) {
58
- var device = hotPlugDevices_1_1.value;
59
- if (!devices.has(device)) {
60
- usb.emit('detach', device);
61
- }
26
+ const devices = new Set(usb.getDeviceList());
27
+ // Find attached devices
28
+ for (const device of devices) {
29
+ if (!hotPlugDevices.has(device)) {
30
+ usb.emit('attach', device);
62
31
  }
63
32
  }
64
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
65
- finally {
66
- try {
67
- if (hotPlugDevices_1_1 && !hotPlugDevices_1_1.done && (_b = hotPlugDevices_1.return)) _b.call(hotPlugDevices_1);
33
+ // Find detached devices
34
+ for (const device of hotPlugDevices) {
35
+ if (!devices.has(device)) {
36
+ usb.emit('detach', device);
68
37
  }
69
- finally { if (e_2) throw e_2.error; }
70
38
  }
71
39
  hotPlugDevices = devices;
72
40
  };
73
41
  // Polling mechanism for checking device changes where hotplug detection is not available
74
- var pollingHotplug = false;
75
- var pollHotplug = function (start) {
76
- if (start === void 0) { start = false; }
42
+ let pollingHotplug = false;
43
+ const pollHotplug = (start = false) => {
77
44
  if (start) {
78
45
  pollingHotplug = true;
79
46
  }
@@ -83,13 +50,13 @@ var pollHotplug = function (start) {
83
50
  else {
84
51
  emitHotplugEvents();
85
52
  }
86
- setTimeout(function () { return pollHotplug(); }, usb.pollHotplugDelay);
53
+ setTimeout(() => pollHotplug(), usb.pollHotplugDelay);
87
54
  };
88
55
  // Devices changed event handler
89
- var devicesChanged = function () { return setTimeout(function () { return emitHotplugEvents(); }, usb.pollHotplugDelay); };
56
+ const devicesChanged = () => setTimeout(() => emitHotplugEvents(), usb.pollHotplugDelay);
90
57
  // Hotplug control
91
- var hotplugSupported = 0;
92
- var startHotplug = function () {
58
+ let hotplugSupported = 0;
59
+ const startHotplug = () => {
93
60
  hotplugSupported = usb.pollHotplug ? 0 : usb._supportedHotplugEvents();
94
61
  if (hotplugSupported !== 1) {
95
62
  // Collect initial devices when not using libusb
@@ -109,7 +76,7 @@ var startHotplug = function () {
109
76
  pollHotplug(true);
110
77
  }
111
78
  };
112
- var stopHotplug = function () {
79
+ const stopHotplug = () => {
113
80
  if (hotplugSupported) {
114
81
  // Disable hotplug events
115
82
  usb._disableHotplugEvents();
@@ -124,20 +91,20 @@ var stopHotplug = function () {
124
91
  pollingHotplug = false;
125
92
  }
126
93
  };
127
- usb.on('newListener', function (event) {
94
+ usb.on('newListener', event => {
128
95
  if (event !== 'attach' && event !== 'detach') {
129
96
  return;
130
97
  }
131
- var listenerCount = usb.listenerCount('attach') + usb.listenerCount('detach');
98
+ const listenerCount = usb.listenerCount('attach') + usb.listenerCount('detach');
132
99
  if (listenerCount === 0) {
133
100
  startHotplug();
134
101
  }
135
102
  });
136
- usb.on('removeListener', function (event) {
103
+ usb.on('removeListener', event => {
137
104
  if (event !== 'attach' && event !== 'detach') {
138
105
  return;
139
106
  }
140
- var listenerCount = usb.listenerCount('attach') + usb.listenerCount('detach');
107
+ const listenerCount = usb.listenerCount('attach') + usb.listenerCount('detach');
141
108
  if (listenerCount === 0) {
142
109
  stopHotplug();
143
110
  }
@@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