Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
stop: () => {
log(
"hid-listen",
"Stop received, removing listeners and cancelling pending debounced polls"
);
debouncedPoll.cancel();
usb.removeListener("attach", attachDetected);
usb.removeListener("detach", detachDetected);
},
events
this.on("removeListener", event => {
const listenerCount = this.listenerCount(event);
if (listenerCount !== 0) {
return;
}
if (event === USBAdapter.EVENT_DEVICE_CONNECT) {
removeListener("attach", attachCallback);
} else if (event === USBAdapter.EVENT_DEVICE_DISCONNECT) {
removeListener("detach", detachCallback);
}
});
}
stop: () => {
log(
"hid-listen",
"Stop received, removing listeners and cancelling pending debounced polls"
);
debouncedPoll.cancel();
usb.removeListener("attach", attachDetected);
usb.removeListener("detach", detachDetected);
},
events
this.on("removeListener", event => {
const listenerCount = this.listenerCount(event);
if (listenerCount !== 0) {
return;
}
if (event === USBAdapter.EVENT_DEVICE_CONNECT) {
removeListener("attach", attachCallback);
} else if (event === USBAdapter.EVENT_DEVICE_DISCONNECT) {
removeListener("detach", detachCallback);
}
});
}