Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
peripheral.once('disconnect', () => {
console.log('disconnected');
// Clean noble's peripheral cache
noble._peripherals = {};
connectionListener(false);
scanButton();
});
}
return new Promise((resolve) => {
let peripheral = noble._peripherals[obj._peripheralId];
if (obj.notifiable && peripheral && peripheral.state === 'connected') {
delete obj.dataListener;
obj.object.unsubscribe(resolve);
} else {
return resolve();
}
});
},