mirror of
https://github.com/iNavFlight/inav-configurator.git
synced 2025-07-15 12:25:13 +03:00
Firmware flasher, BLE, TCP, UDP -> Electron
This commit is contained in:
parent
2f880e218d
commit
7df8253099
36 changed files with 733 additions and 656 deletions
22
js/libraries/bluetooth-device-chooser/renderer.js
Normal file
22
js/libraries/bluetooth-device-chooser/renderer.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
document.addEventListener("DOMContentLoaded", () => {
|
||||
window.electronAPI.bleScan(data => {
|
||||
data.forEach(device => {
|
||||
var dev = document.getElementById(device.deviceId)
|
||||
if (dev) {
|
||||
dev.parentElement.removeChild(dev);
|
||||
}
|
||||
var item = document.createElement('div');
|
||||
item.className = 'item'
|
||||
item.id = device.deviceId;
|
||||
item.addEventListener('click', () => {
|
||||
window.electronAPI.deviceSelected(item.id);
|
||||
window.close();
|
||||
});
|
||||
item.appendChild(document.createTextNode(device.deviceName + ' (' + device.deviceId + ')'));
|
||||
document.getElementById('list').prepend(item);
|
||||
});
|
||||
});
|
||||
document.getElementById('cancel').addEventListener('click', () => {
|
||||
window.close();
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue