[门禁端] 创建项目
This commit is contained in:
31
client-entrance-guard/main.js
Normal file
31
client-entrance-guard/main.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const { app, BrowserWindow } = require('electron')
|
||||
const { platform } = require('node:process')
|
||||
const path = require('path')
|
||||
|
||||
console.log(`This platform is ${platform}`);
|
||||
|
||||
const createWindow = () => {
|
||||
const mainWindow = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, 'preload.js')
|
||||
},
|
||||
})
|
||||
|
||||
mainWindow.loadFile('html/index.html')
|
||||
|
||||
mainWindow.webContents.openDevTools()
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindow()
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') app.quit()
|
||||
})
|
Reference in New Issue
Block a user