This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
/
app.module.ts
69 lines (60 loc) · 2.46 KB
/
app.module.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import * as $ from 'jquery';
import { NgModule, enableProdMode } from '@angular/core';
import { HttpModule } from '@angular/http';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { Authenticator } from '@microsoft/office-js-helpers';
import { SERVICE_PROVIDERS, MonacoService } from './app/services';
import { PIPES } from './app/pipes';
import { EXCEPTION_PROVIDER, Theme, AI, settings } from './app/helpers';
import { COMPONENT_DECLARATIONS } from './components';
import { AppComponent } from './app/containers';
import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { EffectsModule } from '@ngrx/effects';
import { rootReducer, createDefaultState } from './app/reducers';
import { SnippetEffects, MonacoEffects, UIEffects, GitHubEffects } from './app/effects';
import { environment } from './environment';
import './assets/styles/spinner.scss';
import './assets/styles/globals.scss';
@NgModule({
imports: [
BrowserModule,
HttpModule,
FormsModule,
StoreModule.provideStore(rootReducer, createDefaultState(settings.current)),
StoreDevtoolsModule.instrumentOnlyWithExtension(),
EffectsModule.run(SnippetEffects),
EffectsModule.run(MonacoEffects),
EffectsModule.run(GitHubEffects),
EffectsModule.run(UIEffects)
],
declarations: [AppComponent, ...COMPONENT_DECLARATIONS, ...PIPES],
bootstrap: [AppComponent],
providers: [...SERVICE_PROVIDERS, EXCEPTION_PROVIDER]
})
export class AppModule {
static async start() {
try {
if (!environment.current.devMode) {
enableProdMode();
}
await Promise.all([
environment.determineHost(),
MonacoService.initialize()
]);
await Theme.applyTheme(environment.current.host);
if (!Authenticator.isAuthDialog()) {
AI.trackEvent(`Playground ready`, { host: environment.current.host });
platformBrowserDynamic().bootstrapModule(AppModule);
}
}
catch (e) {
$('.ms-progress-component__sub-title').text('Error initializing the Playground.');
$('.ms-progress-component__footer').hide();
AI.trackException(e, 'Playground Initialization');
}
}
}
AppModule.start();