import { app , BrowserWindow , screen } from 'electron' ; import * as path from 'path' ; import * as url from 'url' ; let win , serve ; const args = process . argv . slice ( 1 ) ; serve = args . some ( val => val === '--serve' ) ; function createWindow ( ) { const electronScreen = screen ; const size = electronScreen . getPrimaryDisplay ( ) . workAreaSize ; win = new BrowserWindow ( { x : 0 , y : 0 , width : size . width , height : size . height , webPreferences : { nodeIntegration : true , } , } ) ; if ( serve ) { require ( 'electron-reload' ) ( __dirname , { electron : require ( `${ __dirname }/node_modules/electron` ) } ) ; win . loadURL ( 'http://localhost:4200' ) ; } else { win . loadURL ( url . format ( { pathname : path . join ( __dirname , 'dist/index.html' ) , protocol : 'file:' , slashes : true } ) ) ; } if ( serve ) { win . webContents . openDevTools ( ) ; } win . on ( 'closed' , ( ) => { win = null ; } ) ; } try { app . on ( 'ready' , createWindow ) ; app . on ( 'window-all-closed' , ( ) => { if ( process . platform !== 'darwin' ) { } } ) ; app . on ( 'activate' , ( ) => { if ( win === null ) { createWindow ( ) ; } } ) ; } catch ( e ) { }