From d79d2915fc760c4a03da848fae937d469ed953f0 Mon Sep 17 00:00:00 2001 From: devDefiWeb Date: Sun, 16 Jun 2019 11:39:57 +0300 Subject: [PATCH] web: get back immediate bootstrapping * as https://github.com/electron/electron/issues/17526 got resolved --- .../environments/development/bootstrap-app.ts | 35 +++++++++---------- .../environments/production/bootstrap-app.ts | 21 +++++------ 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/src/web/src/environments/development/bootstrap-app.ts b/src/web/src/environments/development/bootstrap-app.ts index 65de02d4..c1088bef 100644 --- a/src/web/src/environments/development/bootstrap-app.ts +++ b/src/web/src/environments/development/bootstrap-app.ts @@ -8,26 +8,23 @@ import {getZoneNameBoundWebLogger} from "src/web/src/util"; const logger = getZoneNameBoundWebLogger("[environments/development/bootstrap-app]"); -// TODO get rid of "onload" handler, see https://github.com/electron/electron/issues/17526 -window.addEventListener("load", () => { - bootloader(async () => { - try { - const ngModuleRef = await platformBrowserDynamic().bootstrapModule(AppModule); - const applicationRef = ngModuleRef.injector.get(ApplicationRef); - const componentRef = applicationRef.components[0]; +bootloader(async () => { + try { + const ngModuleRef = await platformBrowserDynamic().bootstrapModule(AppModule); + const applicationRef = ngModuleRef.injector.get(ApplicationRef); + const componentRef = applicationRef.components[0]; - enableDebugTools(componentRef); + enableDebugTools(componentRef); - if (!module.hot) { - throw new Error("webpack-dev-server: HMR is not enabled"); - } - - return hmrModule(ngModuleRef, module); - } catch (error) { - // tslint:disable-next-line:no-console - console.error(error); - logger.error(error); - throw error; + if (!module.hot) { + throw new Error("webpack-dev-server: HMR is not enabled"); } - }); + + return hmrModule(ngModuleRef, module); + } catch (error) { + // tslint:disable-next-line:no-console + console.error(error); + logger.error(error); + throw error; + } }); diff --git a/src/web/src/environments/production/bootstrap-app.ts b/src/web/src/environments/production/bootstrap-app.ts index c14fb64a..062c1f46 100644 --- a/src/web/src/environments/production/bootstrap-app.ts +++ b/src/web/src/environments/production/bootstrap-app.ts @@ -6,16 +6,13 @@ import {getZoneNameBoundWebLogger} from "src/web/src/util"; const logger = getZoneNameBoundWebLogger("[environments/production/bootstrap-app]"); -// TODO get rid of "onload" handler, see https://github.com/electron/electron/issues/17526 -window.addEventListener("load", () => { - enableProdMode(); +enableProdMode(); - platformBrowserDynamic() - .bootstrapModule(AppModule) - .catch((error) => { - // tslint:disable-next-line:no-console - console.error(error); - logger.error(error); - throw error; - }); -}); +platformBrowserDynamic() + .bootstrapModule(AppModule) + .catch((error) => { + // tslint:disable-next-line:no-console + console.error(error); + logger.error(error); + throw error; + });