Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async scan () {
try {
const device = await TransportWebBLE.create()
if (!this.devices[device.id]) {
this.devices[device.id] = new Device(device, this.emit)
device.on('disconnect', () => {
this.devices[device.id].disconnect()
delete this.devices[device.id]
// remove list
this.emit('ledger:scan') // Request scan
})
}
} catch (e) {
console.log(e)
}
}
open: (id: string): ?Promise<*> => {
if (id.startsWith("webble")) {
const existingDevice = webbleDevices[id];
return existingDevice
? TransportWebBLE.open(existingDevice)
: TransportWebBLE.create();
}
return null;
},