import "source-map-support/register" ; import { app , dialog } from "electron" ; import { init as initSocket , socket } from "./managers/socketManager" ; import { update as initAutoLaunch } from "./managers/launchManager" ; import { TrayManager } from "./managers/trayManager" ; import { checkForUpdate } from "./util/updateChecker" ; export let trayManager ; export let updateCheckerInterval = null ; app . whenReady ( ) . then ( async ( ) => { trayManager = new TrayManager ( ) ; await initAutoLaunch ( ) ; await initSocket ( ) ; if ( app . isPackaged && app . name . includes ( "Portable" ) ) { await checkForUpdate ( true ) ; updateCheckerInterval = setInterval ( ( ) => { checkForUpdate ( true ) ; } , 15 * 1000 * 60 ) ; } } ) ; app . on ( "second-instance" , ( ) => app . exit ( 0 ) ) ; process . on ( "unhandledRejection" , rejection => { console . error ( rejection ) ; if ( socket && socket . connected ) socket . emit ( "unhandledRejection" , rejection ) ; } ) ; process . on ( "uncaughtException" , err => { dialog . showErrorBox ( err . name , err . stack ) ; app . exit ( 0 ) ; } ) ;