2017-10-27 01:00:52 +08:00
|
|
|
const {app, BrowserWindow} = require('electron')
|
|
|
|
const path = require('path')
|
|
|
|
const url = require('url')
|
|
|
|
|
|
|
|
let win
|
|
|
|
|
|
|
|
function createWindow () {
|
2018-10-18 01:50:25 +08:00
|
|
|
win = new BrowserWindow({
|
|
|
|
icon:'icon.ico',
|
|
|
|
show: false,
|
|
|
|
backgroundColor: '#21252b',
|
|
|
|
webPreferences: {
|
|
|
|
//experimentalFeatures: true,
|
|
|
|
webgl: true,
|
|
|
|
webSecurity: true
|
|
|
|
}
|
|
|
|
})
|
|
|
|
var index_path = path.join(__dirname, 'index.html')
|
|
|
|
if (__dirname.includes('xampp\\htdocs\\')) {
|
|
|
|
index_path = path.join(__dirname, 'index.php')
|
|
|
|
}
|
|
|
|
win.setMenu(null);
|
|
|
|
win.maximize()
|
|
|
|
win.show()
|
|
|
|
win.loadURL(url.format({
|
|
|
|
pathname: index_path,
|
|
|
|
protocol: 'file:',
|
|
|
|
slashes: true
|
|
|
|
}))
|
|
|
|
win.on('closed', () => {
|
|
|
|
win = null
|
|
|
|
})
|
|
|
|
//win.webContents.openDevTools()
|
2017-10-27 01:00:52 +08:00
|
|
|
}
|
|
|
|
|
2018-10-18 01:50:25 +08:00
|
|
|
app.commandLine.appendSwitch('ignore-gpu-blacklist')
|
2017-10-27 01:00:52 +08:00
|
|
|
app.on('ready', createWindow)
|
|
|
|
|
|
|
|
app.on('window-all-closed', () => {
|
2018-12-03 02:37:06 +08:00
|
|
|
//if (process.platform !== 'darwin') {
|
2018-10-18 01:50:25 +08:00
|
|
|
app.quit()
|
2018-12-03 02:37:06 +08:00
|
|
|
//}
|
2017-10-27 01:00:52 +08:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
app.on('activate', () => {
|
2018-10-18 01:50:25 +08:00
|
|
|
if (win === null) {
|
|
|
|
createWindow()
|
|
|
|
}
|
2017-10-27 01:00:52 +08:00
|
|
|
})
|