File tree 2 files changed +10
-10
lines changed 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change 2
2
// MIT License, see LICENSE file for full terms.
3
3
4
4
import * as path from 'path' ;
5
- import * as url from 'url' ;
6
5
import * as BrowserWindow from 'browser-window' ;
7
6
8
7
export interface IApplicationWindowOpenParams {
9
- /** Path to the root directory of the application. */
10
- rootPath : string ;
8
+ windowUrl : string ;
11
9
}
12
10
13
11
export default class ApplicationWindow {
14
12
private _browserWindow : GitHubElectron . BrowserWindow ;
15
13
16
- open ( { rootPath } : IApplicationWindowOpenParams ) : void {
14
+ open ( { windowUrl } : IApplicationWindowOpenParams ) : void {
17
15
const options = < GitHubElectron . BrowserWindowOptions > {
18
16
// the window will be shown later after everything is fully initialized
19
17
show : false ,
@@ -23,11 +21,7 @@ export default class ApplicationWindow {
23
21
}
24
22
} ;
25
23
this . _browserWindow = new BrowserWindow ( options ) ;
26
- this . _browserWindow . loadUrl ( url . format ( {
27
- protocol : 'file' ,
28
- pathname : `${ rootPath } /static/index.html`
29
- } ) ) ;
30
-
24
+ this . _browserWindow . loadUrl ( windowUrl ) ;
31
25
this . _bindEventHandlers ( ) ;
32
26
}
33
27
Original file line number Diff line number Diff line change 1
1
// Copyright (c) 2015 Vadim Macagon
2
2
// MIT License, see LICENSE file for full terms.
3
3
4
+ import * as url from 'url' ;
4
5
import ApplicationWindow from './application-window' ;
5
6
import { AppProtocolHandler } from './protocol-handlers' ;
6
7
7
8
export interface IApplicationArgs {
9
+ /** Path to the root directory of the application. */
8
10
rootPath : string ;
9
11
}
10
12
@@ -15,8 +17,12 @@ export default class Application {
15
17
run ( args : IApplicationArgs ) : void {
16
18
this . _appProtocolHandler = new AppProtocolHandler ( args . rootPath ) ;
17
19
this . _window = new ApplicationWindow ( ) ;
20
+ const windowUrl = url . format ( {
21
+ protocol : 'file' ,
22
+ pathname : `${ args . rootPath } /static/index.html`
23
+ } ) ;
18
24
this . _window . open ( {
19
- rootPath : args . rootPath
25
+ windowUrl
20
26
} ) ;
21
27
}
22
28
}
You can’t perform that action at this time.
0 commit comments