diff --git a/packages/node/src/node-hid-wrapper.ts b/packages/node/src/node-hid-wrapper.ts index 78d8975..9e21ff7 100644 --- a/packages/node/src/node-hid-wrapper.ts +++ b/packages/node/src/node-hid-wrapper.ts @@ -10,8 +10,6 @@ import * as HID from 'node-hid' export class NodeHIDDevice extends EventEmitter implements HIDDevice { constructor(private device: HID.HIDAsync) { super() - this._handleData = this._handleData.bind(this) - this._handleError = this._handleError.bind(this) this.device.on('error', this._handleError) this.device.on('data', this._handleData) @@ -35,10 +33,10 @@ export class NodeHIDDevice extends EventEmitter implements HIDDevice { this.device.removeListener('data', this._handleData) } - private _handleData(data: Buffer) { + private _handleData = (data: Buffer) => { this.emit('data', data) } - private _handleError(error: any) { + private _handleError = (error: any) => { this.emit('error', error) } } diff --git a/packages/webhid/src/web-hid-wrapper.ts b/packages/webhid/src/web-hid-wrapper.ts index 567c23e..f740c46 100644 --- a/packages/webhid/src/web-hid-wrapper.ts +++ b/packages/webhid/src/web-hid-wrapper.ts @@ -16,9 +16,6 @@ export class WebHIDDevice extends EventEmitter implements CoreHIDDevice { constructor(device: HIDDevice) { super() - this._handleInputreport = this._handleInputreport.bind(this) - this._handleError = this._handleError.bind(this) - this.device = device this.device.addEventListener('inputreport', this._handleInputreport)