31 lines
693 B
JavaScript
31 lines
693 B
JavaScript
|
const {app, BrowserWindow} = require('electron')
|
||
|
const path = require('path')
|
||
|
|
||
|
function createWindow () {
|
||
|
const mainWindow = new BrowserWindow({
|
||
|
width: 800,
|
||
|
height: 600
|
||
|
})
|
||
|
|
||
|
mainWindow.webContents.on('select-bluetooth-device', (event, deviceList, callback) => {
|
||
|
event.preventDefault()
|
||
|
if (deviceList && deviceList.length > 0) {
|
||
|
callback(deviceList[0].deviceId)
|
||
|
}
|
||
|
})
|
||
|
|
||
|
mainWindow.loadFile('index.html')
|
||
|
}
|
||
|
|
||
|
app.whenReady().then(() => {
|
||
|
createWindow()
|
||
|
|
||
|
app.on('activate', function () {
|
||
|
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||
|
})
|
||
|
})
|
||
|
|
||
|
app.on('window-all-closed', function () {
|
||
|
if (process.platform !== 'darwin') app.quit()
|
||
|
})
|