-
-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathmain.single-spa.ts
More file actions
28 lines (25 loc) · 1.06 KB
/
main.single-spa.ts
File metadata and controls
28 lines (25 loc) · 1.06 KB
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
import { NavigationStart, Router } from '@angular/router';
import { getSingleSpaExtraProviders, singleSpaAngular } from '@single-spa-community/angular';
import { singleSpaPropsSubject } from './single-spa/single-spa-props';
import { bootstrapApplication, platformBrowser } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import { appConfig } from './app/app.config';
const lifecycles = singleSpaAngular({
bootstrapFunction: async singleSpaProps => {
const platformRef = platformBrowser(getSingleSpaExtraProviders());
singleSpaPropsSubject.next(singleSpaProps);
const appRef = await bootstrapApplication(AppComponent, appConfig, { platformRef });
appRef.onDestroy(() => {
// This is used only for testing purposes.
window.dispatchEvent(new CustomEvent('chatDestroyed'));
});
return appRef;
},
template: '<chat-root />',
NgZone: 'noop',
Router,
NavigationStart,
});
export const bootstrap = lifecycles.bootstrap;
export const mount = lifecycles.mount;
export const unmount = lifecycles.unmount;