Loëck Vézien
7 years ago
4 changed files with 48 additions and 24 deletions
@ -1,4 +1,5 @@ |
|||||
// @flow
|
// @flow
|
||||
|
|
||||
require('../globals') |
require('../globals') |
||||
|
require('./ledger') |
||||
require('./app') |
require('./app') |
||||
|
@ -0,0 +1,22 @@ |
|||||
|
import { ipcMain } from 'electron' |
||||
|
import { isLedgerDevice } from 'ledgerco/lib/utils' |
||||
|
|
||||
|
import HID from 'ledger-node-js-hid' |
||||
|
|
||||
|
ipcMain.on('listenDevices', event => { |
||||
|
HID.listenDevices.start() |
||||
|
|
||||
|
HID.listenDevices.events.on('add', device => { |
||||
|
console.log('add', device, isLedgerDevice(device)) |
||||
|
if (isLedgerDevice(device)) { |
||||
|
event.sender.send('addDevice', device) |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
HID.listenDevices.events.on('remove', device => { |
||||
|
console.log('remove', device, isLedgerDevice(device)) |
||||
|
if (isLedgerDevice(device)) { |
||||
|
event.sender.send('removeDevice', device) |
||||
|
} |
||||
|
}) |
||||
|
}) |
Loading…
Reference in new issue