Files
gnss-tool-kit/src/main/app.ts

43 lines
1017 B
TypeScript
Raw Normal View History

2021-03-09 14:59:24 +08:00
import { app, BrowserWindow } from 'electron'
2021-03-10 18:01:42 +08:00
import {join} from "path";
2021-11-16 15:52:09 +08:00
import './load-serialport'
2021-03-09 14:59:24 +08:00
function createWindow(page: String) {
const win = new BrowserWindow({
fullscreen: true,
frame: false,
webPreferences: {
nodeIntegration: true,
preload: join(__dirname, 'preload.js')
2021-03-09 14:59:24 +08:00
}
})
2021-03-09 14:59:24 +08:00
if (process.env.NODE_ENV === 'development') {
win.loadURL(`http://localhost:3000/${page}.html`)
win.webContents.openDevTools()
} else {
win.loadFile(`dist/render/${page}.html`)
win.webContents.openDevTools()
}
2021-03-09 14:59:24 +08:00
}
function launch() {
2021-11-23 08:37:30 +08:00
// createWindow('satellite-data-monitor-platform')
2021-11-23 01:17:36 +08:00
// createWindow('satellite-info-monitor-platform')
2021-11-23 08:37:30 +08:00
createWindow('satellite-signal-monitor-platform')
2021-11-23 01:17:36 +08:00
// createWindow('satellite-state-monitor-platform')
}
app.whenReady().then(launch)
2021-03-09 14:59:24 +08:00
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
2021-03-09 14:59:24 +08:00
})
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
launch()
}
2021-03-09 14:59:24 +08:00
})