matrix-dimension/web/app/app.module.ts

104 lines
3.7 KiB
TypeScript
Raw Normal View History

2017-12-09 18:34:59 -05:00
import { ApplicationRef, NgModule } 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";
2017-12-09 18:34:59 -05:00
import { createNewHosts, removeNgStyles } from "@angularclass/hmr";
import { NgbModule } from "@ng-bootstrap/ng-bootstrap";
import { RiotComponent } from "./riot/riot.component";
2017-12-15 01:46:17 -05:00
import { ApiService } from "./shared/services/api.service";
import { UiSwitchModule } from "angular2-ui-switch";
2017-12-15 01:46:17 -05:00
import { ScalarService } from "./shared/services/scalar.service";
import { ToasterModule } from "angular2-toaster";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { IntegrationComponent } from "./integration/integration.component";
import { ScalarCloseComponent } from "./riot/scalar-close/scalar-close.component";
2017-12-15 01:46:17 -05:00
import { IntegrationService } from "./shared/services/integration.service";
2017-08-27 01:26:00 -04:00
import { BootstrapModalModule } from "ngx-modialog/plugins/bootstrap";
import { ModalModule } from "ngx-modialog";
2017-12-15 01:46:17 -05:00
import { IrcApiService } from "./shared/services/irc-api.service";
import { GenericWidgetWrapperComponent } from "./widget_wrappers/generic/generic.component";
2017-12-15 01:46:17 -05:00
import { ToggleFullscreenDirective } from "./shared/directives/toggle-fullscreen.directive";
import { FullscreenButtonComponent } from "./fullscreen-button/fullscreen-button.component";
import { VideoWidgetWrapperComponent } from "./widget_wrappers/video/video.component";
import { JitsiWidgetWrapperComponent } from "./widget_wrappers/jitsi/jitsi.component";
import { GCalWidgetWrapperComponent } from "./widget_wrappers/gcal/gcal.component";
import { PageHeaderComponent } from "./page-header/page-header.component";
import { SpinnerComponent } from "./spinner/spinner.component";
import { BreadcrumbsModule } from "ng2-breadcrumbs";
import { RiotHomeComponent } from "./riot/riot-home/home.component";
const WIDGET_CONFIGURATION_COMPONENTS: any[] = IntegrationService.getAllConfigComponents();
@NgModule({
imports: [
BrowserModule,
HttpModule,
FormsModule,
routing,
NgbModule.forRoot(),
UiSwitchModule,
ToasterModule,
BrowserAnimationsModule,
ModalModule.forRoot(),
BootstrapModalModule,
BreadcrumbsModule,
],
declarations: [
...WIDGET_CONFIGURATION_COMPONENTS,
AppComponent,
HomeComponent,
RiotComponent,
IntegrationComponent,
PageHeaderComponent,
SpinnerComponent,
ScalarCloseComponent,
GenericWidgetWrapperComponent,
ToggleFullscreenDirective,
FullscreenButtonComponent,
VideoWidgetWrapperComponent,
JitsiWidgetWrapperComponent,
GCalWidgetWrapperComponent,
RiotHomeComponent,
// Vendor
],
providers: [
ApiService,
ScalarService,
IntegrationService,
2017-06-10 20:58:05 -04:00
IrcApiService,
{provide: Window, useValue: window},
// Vendor
],
bootstrap: [AppComponent],
entryComponents: [
...WIDGET_CONFIGURATION_COMPONENTS,
]
})
export class AppModule {
constructor(public appRef: ApplicationRef) {
}
hmrOnInit(store) {
2017-08-27 01:26:00 -04:00
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;
}
}