31 lines
708 B
TypeScript
31 lines
708 B
TypeScript
|
|
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() {}
|
||
|
|
}
|