import { app , BrowserWindow } from 'electron' ; import path from 'path' ; import * as Menus from './menus' ; import * as WorkspaceMonitors from './workspace-monitor' ; import recorder from './recorder' ; import replayer from './replayer' ; import packageFile from '../package.json' ; if ( process . platform !== 'win32' ) { app . setAboutPanelOptions ( { applicationName : 'Last Hit' , applicationVersion : packageFile . version , iconPath : path . join ( __dirname , '../../icons/64x64.png' ) } ) ; } Menus . buildMenu ( ) ; let mainWindow ; const createWindow = ( ) => { mainWindow = new BrowserWindow ( { width : 780 , height : 480 , icon : path . join ( __dirname , '../../icons/64x64.png' ) , show : false , resizable : false , maximizable : false , title : 'Welcome to LastHit' , webPreferences : { preload : path . join ( __dirname , './preload/index.js' ) , plugins : true , nodeIntegration : true , webviewTag : true } } ) ; mainWindow . loadFile ( 'renderer/build/index.html' ) ; mainWindow . once ( 'ready-to-show' , ( ) => mainWindow . show ( ) ) ; mainWindow . on ( 'closed' , ( ) => { mainWindow = null ; } ) ; } ; WorkspaceMonitors . initialize ( ) ; recorder . initialize ( replayer ) ; replayer . initialize ( ) ; app . on ( 'ready' , ( ) => createWindow ( ) ) ; app . on ( 'window-all-closed' , ( ) => { if ( process . platform !== 'darwin' ) { app . quit ( ) ; } } ) ; app . on ( 'activate' , ( ) => { if ( mainWindow === null ) { createWindow ( ) ; } } ) ;