import { app , BrowserWindow } from "electron" ; import { setupDevTools } from "./devtools" ; if ( require ( "electron-squirrel-startup" ) ) { app . quit ( ) ; } let mainWindow ; const createWindow = ( ) : void => { mainWindow = new BrowserWindow ( { width : 800 , height : 600 , webPreferences : { nodeIntegration : true , webSecurity : false } } ) ; mainWindow . loadURL ( MAIN_WINDOW_WEBPACK_ENTRY ) ; mainWindow . webContents . once ( "dom-ready" , ( ) => { mainWindow . webContents . openDevTools ( ) ; } ) ; mainWindow . on ( "closed" , ( ) => { mainWindow = null ; } ) ; } ; app . on ( "ready" , ( ) => { createWindow ( ) ; setupDevTools ( ) ; } ) ; app . on ( "window-all-closed" , ( ) => { if ( process . platform !== "darwin" ) { app . quit ( ) ; } } ) ; app . on ( "activate" , ( ) => { if ( mainWindow === null ) { createWindow ( ) ; } } ) ;