mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-24 07:17:18 +00:00
fix(sdk): Remove event listeners on unsubscribe (#1834)
Change-Type: patch
This commit is contained in:
parent
08b6397a9a
commit
8b13a23117
@ -180,7 +180,6 @@ SDK.Scanner = class Scanner extends EventEmitter {
|
||||
}
|
||||
|
||||
this.adapters.forEach((adapter) => {
|
||||
// Adapter.stopScan()
|
||||
adapter.removeListener('devices', this.onDevices)
|
||||
adapter.removeListener('error', this.onError)
|
||||
})
|
||||
@ -231,6 +230,9 @@ SDK.Scanner = class Scanner extends EventEmitter {
|
||||
return this
|
||||
}
|
||||
|
||||
instance.removeListener('devices', this.onDevices)
|
||||
instance.removeListener('error', this.onError)
|
||||
|
||||
this.adapters.delete(instance.name)
|
||||
this.emit('unsubscribe', adapter)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user