mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 10:08:57 +00:00
24 lines
819 B
TypeScript
24 lines
819 B
TypeScript
import 'angular2-universal-polyfills/browser';
|
|
import { enableProdMode } from '@angular/core';
|
|
import { platformUniversalDynamic } from 'angular2-universal';
|
|
import { AppModule } from './app/app.module';
|
|
import 'bootstrap';
|
|
|
|
// Enable either Hot Module Reloading or production mode
|
|
const hotModuleReplacement = module['hot'];
|
|
if (hotModuleReplacement) {
|
|
hotModuleReplacement.accept();
|
|
hotModuleReplacement.dispose(() => { platform.destroy(); });
|
|
} else {
|
|
enableProdMode();
|
|
}
|
|
|
|
// Boot the application, either now or when the DOM content is loaded
|
|
const platform = platformUniversalDynamic();
|
|
const bootApplication = () => { platform.bootstrapModule(AppModule); };
|
|
if (document.readyState === 'complete') {
|
|
bootApplication();
|
|
} else {
|
|
document.addEventListener('DOMContentLoaded', bootApplication);
|
|
}
|