File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,15 +57,15 @@ export class AppService implements AppServiceTrait {
5757 } ) ;
5858 app . whenReady ( ) . then (
5959 async ( ) => {
60- log . info ( `Starting service ${ ServiceType . maa } ...` ) ;
6160 await this . _maaService . create ( ) ;
6261 log . info ( `Service ${ ServiceType . maa } started` ) ;
63- log . info ( `Starting service ${ ServiceType . tray } ...` ) ;
62+
6463 this . _trayService . create ( ) ;
6564 log . info ( `Service ${ ServiceType . tray } started` ) ;
66- log . info ( `Starting service ${ ServiceType . window } ...` ) ;
65+
6766 this . _windowService . getWindow ( WindowType . main ) . create ( ) ;
6867 log . info ( `Service ${ ServiceType . window } started` ) ;
68+
6969 log . info ( `${ packageJson . productName } is ready` ) ;
7070 } ,
7171 ( ) => { } ,
Original file line number Diff line number Diff line change 11import { BrowserWindow } from 'electron' ;
2- import Logger from 'electron-log' ;
32
43import { DEFAULT_CONSTRUCT_OPTIONS } from 'app/src-electron/service/window/base/constants' ;
54import type { ConstructOptions } from 'app/src-electron/service/window/base/types' ;
65
76import { WINDOW_URL_MAPPING } from 'src/types/service/window/constants' ;
87import type { WindowType } from 'src/types/service/window/types' ;
8+ import log from 'electron-log' ;
99
1010export abstract class BaseWindow {
1111 private readonly _constructOptions : ConstructOptions ;
12- private readonly _url : string ;
12+ private readonly _hash : string ;
1313 protected _window ?: BrowserWindow | undefined ;
1414
1515 protected constructor ( windowType : WindowType , constructOptions ?: ConstructOptions ) {
1616 this . _constructOptions = {
1717 ...DEFAULT_CONSTRUCT_OPTIONS ,
1818 ...constructOptions ,
1919 } ;
20- this . _url = ` ${ process . env . APP_URL } # ${ WINDOW_URL_MAPPING [ windowType ] } ` ;
20+ this . _hash = WINDOW_URL_MAPPING [ windowType ] ;
2121 }
2222
2323 create ( ) {
@@ -41,7 +41,11 @@ export abstract class BaseWindow {
4141 }
4242 }
4343 } ) ;
44- this . _window . loadURL ( this . _url ) . catch ( ( e ) => Logger . warn ( 'loadURL' , e ) ) ;
44+ if ( process . env . DEV ) {
45+ this . _window . loadURL ( `${ process . env . APP_URL } #${ this . _hash } ` ) . catch ( ( e ) => log . warn ( 'loadURL' , e ) ) ;
46+ } else {
47+ this . _window . loadFile ( 'index.html' , { hash : this . _hash } ) . catch ( ( e ) => log . warn ( 'loadFile' , e ) ) ;
48+ }
4549
4650 return this . _window ;
4751 }
You can’t perform that action at this time.
0 commit comments