Typescript - fix pop url validation issue & browserify preload

This commit is contained in:
Kiran Niranjan 2018-12-28 10:57:12 +05:30
parent cbb920ef1d
commit 4f65ee21cf
2 changed files with 6 additions and 2 deletions

View File

@ -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",

View File

@ -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) {