WebBluetooth integration sample with electron. Supports selecting multiple device.
- electron(>=3 will work)
- bootstrap(included)
- npm i
- npx electron .
- In renderer, scan() to get device list.
- The devices list is notified periodically via IPC to main process.
- If you find the deviceId you want to connect, select and notify to main.
- Connection callback called only once in main.
- When disconnected, automatically reconnect former connected device.
- If event.preventDefault is not called, first available device will be selected.
- Callback should be called with deviceId to be selected, passing empty string to callback will cancel the request.
- Calling requestDevice twice causes automatically cancel the former one.
Electron Documentation - webContents - select-bluetooth-device Electron Documentation - webContents - executejavascriptcode-usergesture
MIT