diff --git a/package.json b/package.json index c4fd0f6e..c22079bb 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,10 @@ "scripts": { "tsc": "git clean -xdf ./lib && npm run lint && tsc", "lint": "tslint --project tsconfig.json", - "start": "npm run compile-css && cross-env ELECTRON_DEV=true electron .", + "start": "npm run compile-css && npm run browserify-preload && cross-env ELECTRON_DEV=true electron .", "compile-css": "lessc src/renderer/styles/main.less src/renderer/styles/main.css", "prebuild": "npm run rebuild && npm run browserify-preload", - "browserify-preload": "browserify -o js/preload/_preloadMain.js -x electron --insert-global-vars=__filename,__dirname js/preload/preloadMain.js --exclude electron-spellchecker", + "browserify-preload": "browserify -o src/renderer/_preload-main.js -x electron --insert-global-vars=__filename,__dirname src/renderer/preload-main.js", "rebuild": "electron-rebuild -f", "dev": "npm run prebuild && cross-env ELECTRON_DEV=true electron .", "test": "npm run lint && npm rebuild --build-from-source && cross-env ELECTRON_QA=true jest --config jest.unit.config.json --runInBand && npm run rebuild", diff --git a/src/browser/window-handler.ts b/src/browser/window-handler.ts index ca3275cc..0aa06680 100644 --- a/src/browser/window-handler.ts +++ b/src/browser/window-handler.ts @@ -147,8 +147,11 @@ export class WindowHandler { } }); + // Get url to load from cmd line or from global config file const urlFromCmd = getCommandLineArgs(process.argv, '--url=', false); this.url = urlFromCmd && urlFromCmd.substr(6) || WindowHandler.getValidUrl(this.globalConfig.url); + + // loads the main window with url from config/cmd line this.mainWindow.loadURL(this.url); this.mainWindow.webContents.on('did-finish-load', () => { // close the loading window when @@ -159,6 +162,7 @@ export class WindowHandler { } // early exit if the window has already been destroyed if (!this.mainWindow || this.mainWindow.isDestroyed()) return; + this.url = this.mainWindow.webContents.getURL(); // Injects custom title bar css into the webContents if (this.mainWindow && this.isCustomTitleBarAndWindowOS) {