blockbench/main.js

50 lines
989 B
JavaScript
Raw Normal View History

2017-10-26 19:00:52 +02:00
const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
let win
function createWindow () {
2018-10-17 19:50:25 +02:00
win = new BrowserWindow({
icon:'icon.ico',
show: false,
backgroundColor: '#21252b',
webPreferences: {
//experimentalFeatures: true,
webgl: true,
2018-12-29 12:26:02 +01:00
webSecurity: true,
nodeIntegration: true
2018-10-17 19:50:25 +02:00
}
})
var index_path = path.join(__dirname, 'index.html')
2019-01-09 15:54:35 +01:00
/*if (__dirname.includes('xampp\\htdocs\\')) {
index_path = path.join(__dirname, 'index.php')
}*/
2018-10-17 19:50:25 +02:00
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-26 19:00:52 +02:00
}
2018-10-17 19:50:25 +02:00
app.commandLine.appendSwitch('ignore-gpu-blacklist')
2019-01-09 15:54:35 +01:00
2017-10-26 19:00:52 +02:00
app.on('ready', createWindow)
app.on('window-all-closed', () => {
2018-12-29 12:26:02 +01:00
app.quit()
2017-10-26 19:00:52 +02:00
})
app.on('activate', () => {
2018-10-17 19:50:25 +02:00
if (win === null) {
createWindow()
}
2019-01-09 15:54:35 +01:00
})