You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.0 KiB
52 lines
1.0 KiB
const {app, BrowserWindow, ipcMain} = require('electron');
|
|
|
|
var window;
|
|
function createWindow()
|
|
{
|
|
var width = 800;
|
|
var height=600;
|
|
const win = new BrowserWindow({
|
|
width,
|
|
height,
|
|
frame:false,
|
|
minimizable: true,
|
|
webPreferences:
|
|
{
|
|
nodeIntegration:false,
|
|
contextIsolation:true,
|
|
preload: __dirname + '/preload.js'
|
|
}
|
|
|
|
})
|
|
win.removeMenu();
|
|
win.webContents.openDevTools();
|
|
win.loadURL('http://localhost:3000');
|
|
return win;
|
|
|
|
}
|
|
app.on('ready', ()=>
|
|
{
|
|
window = createWindow();
|
|
} )
|
|
|
|
ipcMain.on('close', (event, data) =>
|
|
{
|
|
app.quit();
|
|
})
|
|
ipcMain.on('maximize', (event, data) =>
|
|
{
|
|
window.isMaximized() ? window.unmaximize() : window.maximize()
|
|
})
|
|
ipcMain.on('minimize', (event, data) =>
|
|
{
|
|
window.hide();
|
|
});
|
|
|
|
app.on('window-all-closed', ()=>
|
|
{
|
|
if(process.platform !== 'darwin') app.quit();
|
|
})
|
|
app.on('activate', ()=>
|
|
{
|
|
if(BrowserWindow.getAllWindows().length === 0) createWindow();
|
|
}) |