import { app , BrowserWindow } from 'electron' ; import { setMenu } from './menu' ; import { cleanup } from './temporary' ; let mainWindow ; function createWindow ( ) { mainWindow = new BrowserWindow ( { width : 1024 , height : 768 } ) ; mainWindow . loadURL ( `file://${ __dirname }/index.html` ) ; mainWindow . on ( 'closed' , ( ) => { mainWindow = null ; } ) ; setMenu ( mainWindow , app . getName ( ) ) ; } app . on ( 'ready' , createWindow ) ; app . on ( 'window-all-closed' , ( ) => { if ( process . platform !== 'darwin' ) { app . quit ( ) ; } } ) ; app . on ( 'activate' , ( ) => { if ( mainWindow === null ) { createWindow ( ) ; } } ) ; app . on ( 'quit' , ( ) => { cleanup ( ) ; } ) ;