本文整理汇总了TypeScript中@angularclass/hmr.bootloader函数的典型用法代码示例。如果您正苦于以下问题:TypeScript bootloader函数的具体用法?TypeScript bootloader怎么用?TypeScript bootloader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bootloader函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: enableProdMode
import './polyfills.browser';
import './rxjs.imports';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { bootloader } from '@angularclass/hmr';
import { AppModule } from './app/app.module';
import { decorateModuleRef } from './environment';
if ('production' === ENV) {
enableProdMode();
}
export function main(): Promise<any> {
return platformBrowserDynamic()
.bootstrapModule(AppModule)
.then(decorateModuleRef)
.catch(err => console.error(err));
}
// needed for hmr
// in prod this is replace for document ready
bootloader(main);
示例2: main
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { bootloader } from '@angularclass/hmr';
import { AppModule } from './module';
export function main(): Promise<any> {
return platformBrowserDynamic()
.bootstrapModule(AppModule)
.catch(err => console.error(err));
}
if(HMR) bootloader(main);
if(!HMR) main();
示例3: enableProdMode
// import "zone.js/dist/zone-node.js";
import {enableProdMode} from "@angular/core";
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {AppModule} from "./app/app.module";
import {bootloader} from "@angularclass/hmr";
if (__IS_PROD_MODE__) {
enableProdMode();
}
function startApplication(){
const platform = platformBrowserDynamic();
platform.bootstrapModule(AppModule);
}
bootloader(startApplication);
示例4: hmrOnDestroy
}
if ('restoreInputValues' in store) { store.restoreInputValues(); }
this.appRef.tick();
Object.keys(store).forEach(prop => delete store[prop]);
}
hmrOnDestroy(store) {
const cmpLocation = this.appRef.components.map(cmp => cmp.location.nativeElement);
this.store.first().subscribe(s => store.rootState = s);
store.disposeOldHosts = createNewHosts(cmpLocation);
store.restoreInputValues = createInputTransfer();
removeNgStyles();
}
hmrAfterDestroy(store) {
store.disposeOldHosts();
delete store.disposeOldHosts;
}
}
console.log('[BASE] DEVELOPMENT MODE');
export function bootstrapApp() {
platformBrowserDynamic()
.bootstrapModule(DevelopmentModule)
.catch((err) => console.error(err));
}
bootloader(bootstrapApp);