resolve null usage
This commit is contained in:
parent
8ab4da0cae
commit
c7da3b210b
1 changed files with 23 additions and 12 deletions
11
plejd/ble.js
11
plejd/ble.js
|
|
@ -253,17 +253,28 @@ class PlejdService extends EventEmitter {
|
||||||
|
|
||||||
clearInterval(this.pingRef);
|
clearInterval(this.pingRef);
|
||||||
|
|
||||||
|
if (this.device) {
|
||||||
this.device.removeAllListeners('servicesDiscover');
|
this.device.removeAllListeners('servicesDiscover');
|
||||||
this.device.removeAllListeners('connect');
|
this.device.removeAllListeners('connect');
|
||||||
this.device.removeAllListeners('disconnect');
|
this.device.removeAllListeners('disconnect');
|
||||||
|
}
|
||||||
|
if (this.characteristics.auth) {
|
||||||
this.characteristics.auth.removeAllListeners('read');
|
this.characteristics.auth.removeAllListeners('read');
|
||||||
this.characteristics.auth.removeAllListeners('write');
|
this.characteristics.auth.removeAllListeners('write');
|
||||||
|
}
|
||||||
|
if (this.characteristics.data) {
|
||||||
this.characteristics.data.removeAllListeners('read');
|
this.characteristics.data.removeAllListeners('read');
|
||||||
this.characteristics.data.removeAllListeners('write');
|
this.characteristics.data.removeAllListeners('write');
|
||||||
|
}
|
||||||
|
if (this.characteristics.lastData) {
|
||||||
this.characteristics.lastData.removeAllListeners('read');
|
this.characteristics.lastData.removeAllListeners('read');
|
||||||
this.characteristics.lastData.removeAllListeners('write');
|
this.characteristics.lastData.removeAllListeners('write');
|
||||||
|
}
|
||||||
|
if (this.characteristics.ping) {
|
||||||
this.characteristics.ping.removeAllListeners('read');
|
this.characteristics.ping.removeAllListeners('read');
|
||||||
this.characteristics.ping.removeAllListeners('write');
|
this.characteristics.ping.removeAllListeners('write');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
this.connectEventHooked = false;
|
this.connectEventHooked = false;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue