实现多开并且串口数据处理后传递至渲染端
This commit is contained in:
@@ -2,36 +2,62 @@ import { app, BrowserWindow } from 'electron'
|
||||
import {join} from "path";
|
||||
import './load-serialport'
|
||||
|
||||
function createWindow() {
|
||||
const win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: true,
|
||||
preload: join(__dirname, 'preload.js')
|
||||
}
|
||||
})
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
win.loadURL('http://localhost:3000/')
|
||||
win.webContents.openDevTools()
|
||||
} else {
|
||||
win.loadFile('dist/render/index.html')
|
||||
|
||||
function createWindow(page: String) {
|
||||
|
||||
const win = new BrowserWindow({
|
||||
fullscreen: true,
|
||||
frame: false,
|
||||
webPreferences: {
|
||||
// webSecurity: false,
|
||||
nodeIntegration: true,
|
||||
preload: join(__dirname, 'preload.js')
|
||||
}
|
||||
})
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
// if (process.env.NODE_ENV === 'development') {
|
||||
// win.loadURL(`http://localhost:3000/?page=${page}`)
|
||||
// win.webContents.openDevTools()
|
||||
// } else {
|
||||
// win.loadFile(`dist/render/index.html?page=${page}`)
|
||||
// // win.loadURL(`file://${__dirname}/dist/render/index.html?page=${page}`);
|
||||
// win.webContents.openDevTools()
|
||||
// }
|
||||
}
|
||||
|
||||
app.whenReady().then(createWindow)
|
||||
function launch() {
|
||||
|
||||
createWindow('satellite-data-monitor-platform')
|
||||
createWindow('satellite-info-monitor-platform')
|
||||
createWindow('satellite-signal-monitor-platform')
|
||||
createWindow('satellite-state-monitor-platform')
|
||||
|
||||
|
||||
// createWindow('DataMonitorPage')
|
||||
// createWindow('InfoMonitorPage')
|
||||
// createWindow('SignalMonitorPage')
|
||||
// createWindow('StateMonitorPage')
|
||||
}
|
||||
|
||||
app.whenReady().then(launch)
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
createWindow()
|
||||
}
|
||||
if (BrowserWindow.getAllWindows().length === 0) {
|
||||
launch()
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user