25 lines
589 B
JavaScript
25 lines
589 B
JavaScript
|
const { app, BrowserWindow, ipcMain } = require('electron')
|
||
|
|
||
|
let onlineStatusWindow
|
||
|
|
||
|
app.whenReady().then(() => {
|
||
|
onlineStatusWindow = new BrowserWindow({ width: 0, height: 0, show: false, webPreferences: { nodeIntegration: true } })
|
||
|
onlineStatusWindow.loadURL(`file://${__dirname}/index.html`)
|
||
|
})
|
||
|
|
||
|
ipcMain.on('online-status-changed', (event, status) => {
|
||
|
console.log(status)
|
||
|
})
|
||
|
|
||
|
app.on('window-all-closed', () => {
|
||
|
if (process.platform !== 'darwin') {
|
||
|
app.quit()
|
||
|
}
|
||
|
})
|
||
|
|
||
|
app.on('activate', () => {
|
||
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||
|
createWindow()
|
||
|
}
|
||
|
})
|