| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- const { app, BrowserWindow } = require('electron');
- const path = require('path');
- const url = require('url');
- const isLocal = process.argv[process.argv.length - 1] === 'local';
- const extDir = isLocal ? '../build/production/saas' : 'dist';
- let mainWindow;
- function createWindow () {
- mainWindow = new BrowserWindow({ width: 1280, height: 720, show: false });
- mainWindow.once('ready-to-show', function(){
- mainWindow.maximize();
- mainWindow.show();
- });
- mainWindow.loadURL(url.format({
- pathname: path.join(__dirname, extDir + '/index.html'),
- protocol: 'file:',
- slashes: true
- }));
- if (isLocal) {
- mainWindow.webContents.openDevTools();
- }
- mainWindow.on('closed', function () {
- mainWindow = null;
- });
- }
- app.on('ready', createWindow);
- // Quit when all windows are closed, except for Mac users
- app.on('window-all-closed', function () {
- if (process.platform !== 'darwin') {
- app.quit()
- }
- });
- app.on('activate', function () {
- if (mainWindow === null) {
- createWindow();
- }
- });
|