init commit
This commit is contained in:
30
src/main/window/BaseWindow.ts
Normal file
30
src/main/window/BaseWindow.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { join } from 'path'
|
||||
import { Menu, BrowserWindow } from 'electron'
|
||||
|
||||
Menu.setApplicationMenu(null)
|
||||
|
||||
// TODO: 修改标题栏ico图标
|
||||
const BASE_WINDOW_OPTIONS = {
|
||||
icon: join(__dirname, '../../../public/favicon.ico'),
|
||||
webPreferences : {
|
||||
nodeIntegration : true,
|
||||
enableBlinkFeatures: 'Serial',
|
||||
experimentalFeatures: true,
|
||||
preload : join(__dirname, '../preload.js')
|
||||
},
|
||||
}
|
||||
|
||||
export abstract class BaseWindow extends BrowserWindow {
|
||||
constructor (options = {}) {
|
||||
Object.assign(options, BASE_WINDOW_OPTIONS)
|
||||
super(options)
|
||||
|
||||
this.bindIpcEvent()
|
||||
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
this.webContents.openDevTools()
|
||||
}
|
||||
}
|
||||
|
||||
bindIpcEvent() {}
|
||||
}
|
||||
Reference in New Issue
Block a user