mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
0c51d4424b
Part of #11 Needs actual scalar integration
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import { NgModule, ApplicationRef } from "@angular/core";
|
|
import { BrowserModule } from "@angular/platform-browser";
|
|
import { HttpModule } from "@angular/http";
|
|
import { FormsModule } from "@angular/forms";
|
|
import { AppComponent } from "./app.component";
|
|
import { HomeComponent } from "./home/home.component";
|
|
import { routing } from "./app.routing";
|
|
import { removeNgStyles, createNewHosts } from "@angularclass/hmr";
|
|
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
|
|
import { RiotComponent } from "./riot/riot.component";
|
|
import { ApiService } from "./shared/api.service";
|
|
import { BotComponent } from "./bot/bot.component";
|
|
import { UiSwitchModule } from "angular2-ui-switch";
|
|
|
|
@NgModule({
|
|
imports: [
|
|
BrowserModule,
|
|
HttpModule,
|
|
FormsModule,
|
|
routing,
|
|
NgbModule.forRoot(),
|
|
UiSwitchModule,
|
|
],
|
|
declarations: [
|
|
AppComponent,
|
|
HomeComponent,
|
|
RiotComponent,
|
|
BotComponent,
|
|
|
|
// Vendor
|
|
],
|
|
providers: [
|
|
ApiService,
|
|
|
|
// Vendor
|
|
],
|
|
bootstrap: [AppComponent],
|
|
entryComponents: []
|
|
})
|
|
export class AppModule {
|
|
constructor(public appRef: ApplicationRef) {
|
|
}
|
|
|
|
hmrOnInit(store) {
|
|
console.log('HMR store', store);
|
|
}
|
|
|
|
hmrOnDestroy(store) {
|
|
let cmpLocation = this.appRef.components.map(cmp => cmp.location.nativeElement);
|
|
// recreate elements
|
|
store.disposeOldHosts = createNewHosts(cmpLocation);
|
|
// remove styles
|
|
removeNgStyles();
|
|
}
|
|
|
|
hmrAfterDestroy(store) {
|
|
// display new elements
|
|
store.disposeOldHosts();
|
|
delete store.disposeOldHosts;
|
|
}
|
|
}
|