@worktile/planet 12.1.1 → 12.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/application/planet-application-loader.d.ts +70 -0
- package/application/planet-application-loader.d.ts.map +1 -0
- package/application/planet-application-loader.ngfactory.d.ts.map +1 -0
- package/application/planet-application-ref.d.ts +36 -0
- package/application/planet-application-ref.d.ts.map +1 -0
- package/application/planet-application.service.d.ts +19 -0
- package/application/planet-application.service.d.ts.map +1 -0
- package/application/planet-application.service.ngfactory.d.ts.map +1 -0
- package/{packages/planet/src/application/portal-application.ts → application/portal-application.d.ts} +5 -18
- package/application/portal-application.d.ts.map +1 -0
- package/assets-loader.d.ts +33 -0
- package/assets-loader.d.ts.map +1 -0
- package/assets-loader.ngfactory.d.ts.map +1 -0
- package/bundles/worktile-planet.umd.js +2564 -0
- package/bundles/worktile-planet.umd.js.map +1 -0
- package/component/planet-component-loader.d.ts +28 -0
- package/component/planet-component-loader.d.ts.map +1 -0
- package/component/planet-component-loader.ngfactory.d.ts.map +1 -0
- package/component/planet-component-ref.d.ts +8 -0
- package/component/planet-component-ref.d.ts.map +1 -0
- package/{packages/planet/src/component/plant-component.config.ts → component/plant-component.config.d.ts} +4 -4
- package/component/plant-component.config.d.ts.map +1 -0
- package/debug.d.ts +22 -0
- package/debug.d.ts.map +1 -0
- package/empty/empty.component.d.ts +3 -0
- package/empty/empty.component.d.ts.map +1 -0
- package/empty/empty.component.ngfactory.d.ts.map +1 -0
- package/esm2015/application/planet-application-loader.js +457 -0
- package/esm2015/application/planet-application-ref.js +97 -0
- package/esm2015/application/planet-application.service.js +87 -0
- package/esm2015/application/portal-application.js +16 -0
- package/esm2015/assets-loader.js +217 -0
- package/esm2015/component/planet-component-loader.js +155 -0
- package/esm2015/component/planet-component-ref.js +3 -0
- package/esm2015/component/plant-component.config.js +7 -0
- package/esm2015/debug.js +33 -0
- package/esm2015/empty/empty.component.js +10 -0
- package/esm2015/global-event-dispatcher.js +71 -0
- package/esm2015/global-planet.js +54 -0
- package/esm2015/helpers.js +119 -0
- package/esm2015/module.js +27 -0
- package/esm2015/planet.class.js +9 -0
- package/esm2015/planet.js +91 -0
- package/esm2015/public-api.js +18 -0
- package/esm2015/sandbox/constants.js +7 -0
- package/esm2015/sandbox/exec.js +15 -0
- package/esm2015/sandbox/index.js +20 -0
- package/esm2015/sandbox/proxy/patches/document.js +12 -0
- package/esm2015/sandbox/proxy/patches/eventListener.js +41 -0
- package/esm2015/sandbox/proxy/patches/index.js +11 -0
- package/esm2015/sandbox/proxy/patches/storage.js +40 -0
- package/esm2015/sandbox/proxy/patches/timer.js +43 -0
- package/esm2015/sandbox/proxy/proxies/common.js +132 -0
- package/esm2015/sandbox/proxy/proxies/document.js +126 -0
- package/esm2015/sandbox/proxy/proxies/window.js +155 -0
- package/esm2015/sandbox/proxy/proxy-sandbox.js +49 -0
- package/esm2015/sandbox/proxy/types.js +2 -0
- package/esm2015/sandbox/sandbox.js +7 -0
- package/esm2015/sandbox/snapshot/snapshot-sandbox.js +12 -0
- package/esm2015/sandbox/types.js +2 -0
- package/esm2015/worktile-planet.js +6 -0
- package/fesm2015/worktile-planet.js +2048 -0
- package/fesm2015/worktile-planet.js.map +1 -0
- package/global-event-dispatcher.d.ts +20 -0
- package/global-event-dispatcher.d.ts.map +1 -0
- package/global-event-dispatcher.ngfactory.d.ts.map +1 -0
- package/global-planet.d.ts +23 -0
- package/global-planet.d.ts.map +1 -0
- package/helpers.d.ts +39 -0
- package/helpers.d.ts.map +1 -0
- package/module.d.ts +6 -0
- package/module.d.ts.map +1 -0
- package/module.ngfactory.d.ts.map +1 -0
- package/package.json +16 -121
- package/{packages/planet/src/planet.class.ts → planet.class.d.ts} +5 -26
- package/planet.class.d.ts.map +1 -0
- package/planet.d.ts +25 -0
- package/planet.d.ts.map +1 -0
- package/planet.ngfactory.d.ts.map +1 -0
- package/{packages/planet/src/public-api.ts → public-api.d.ts} +1 -4
- package/public-api.d.ts.map +1 -0
- package/sandbox/constants.d.ts +7 -0
- package/sandbox/constants.d.ts.map +1 -0
- package/sandbox/exec.d.ts +3 -0
- package/sandbox/exec.d.ts.map +1 -0
- package/sandbox/index.d.ts +7 -0
- package/sandbox/index.d.ts.map +1 -0
- package/sandbox/proxy/patches/document.d.ts +3 -0
- package/sandbox/proxy/patches/document.d.ts.map +1 -0
- package/sandbox/proxy/patches/eventListener.d.ts +3 -0
- package/sandbox/proxy/patches/eventListener.d.ts.map +1 -0
- package/sandbox/proxy/patches/index.d.ts +3 -0
- package/sandbox/proxy/patches/index.d.ts.map +1 -0
- package/sandbox/proxy/patches/storage.d.ts +15 -0
- package/sandbox/proxy/patches/storage.d.ts.map +1 -0
- package/sandbox/proxy/patches/timer.d.ts +3 -0
- package/sandbox/proxy/patches/timer.d.ts.map +1 -0
- package/sandbox/proxy/proxies/common.d.ts +13 -0
- package/sandbox/proxy/proxies/common.d.ts.map +1 -0
- package/sandbox/proxy/proxies/document.d.ts +14 -0
- package/sandbox/proxy/proxies/document.d.ts.map +1 -0
- package/sandbox/proxy/proxies/window.d.ts +13 -0
- package/sandbox/proxy/proxies/window.d.ts.map +1 -0
- package/sandbox/proxy/proxy-sandbox.d.ts +16 -0
- package/sandbox/proxy/proxy-sandbox.d.ts.map +1 -0
- package/{packages/planet/src/sandbox/proxy/types.ts → sandbox/proxy/types.d.ts} +2 -8
- package/sandbox/proxy/types.d.ts.map +1 -0
- package/sandbox/sandbox.d.ts +12 -0
- package/sandbox/sandbox.d.ts.map +1 -0
- package/sandbox/snapshot/snapshot-sandbox.d.ts +9 -0
- package/sandbox/snapshot/snapshot-sandbox.d.ts.map +1 -0
- package/sandbox/types.d.ts +2 -0
- package/sandbox/types.d.ts.map +1 -0
- package/worktile-planet.d.ts +6 -0
- package/worktile-planet.d.ts.map +1 -0
- package/worktile-planet.metadata.json +1 -0
- package/.all-contributorsrc +0 -84
- package/.circleci/config.yml +0 -17
- package/.coveralls.yml +0 -1
- package/.docgeni/public/assets/favicon.ico +0 -0
- package/.docgeni/public/index.html +0 -13
- package/.docgenirc.js +0 -35
- package/.dockerignore +0 -1
- package/.editorconfig +0 -22
- package/.github/FUNDING.yml +0 -12
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/.prettierignore +0 -7
- package/.prettierrc +0 -28
- package/.travis.yml +0 -26
- package/.wpmrc.js +0 -11
- package/CHANGELOG.md +0 -391
- package/CODE_OF_CONDUCT.md +0 -76
- package/Dockerfile +0 -11
- package/LICENSE +0 -21
- package/README.md +0 -348
- package/README.zh-CN.md +0 -307
- package/SECURITY.md +0 -21
- package/angular.json +0 -373
- package/commitlint.config.js +0 -6
- package/docs/api/defineApplication.md +0 -46
- package/docs/api/globalEventDispatcher.md +0 -51
- package/docs/api/index.md +0 -5
- package/docs/api/planet.md +0 -117
- package/docs/guides/getting-started.md +0 -174
- package/docs/guides/index.md +0 -5
- package/docs/guides/intro.md +0 -216
- package/examples/app1/browserslist +0 -11
- package/examples/app1/extra-webpack.config.js +0 -33
- package/examples/app1/karma.conf.js +0 -31
- package/examples/app1/postcss.config.js +0 -1
- package/examples/app1/src/app/app.module.ts +0 -44
- package/examples/app1/src/app/app.routing.ts +0 -49
- package/examples/app1/src/app/counter.service.ts +0 -16
- package/examples/app1/src/app/dashboard/dashboard.component.html +0 -51
- package/examples/app1/src/app/dashboard/dashboard.component.ts +0 -70
- package/examples/app1/src/app/detail/detail.component.html +0 -8
- package/examples/app1/src/app/detail/detail.component.ts +0 -18
- package/examples/app1/src/app/overlay.ts +0 -26
- package/examples/app1/src/app/projects/dialog/projects-dialog.component.html +0 -10
- package/examples/app1/src/app/projects/dialog/projects-dialog.component.ts +0 -41
- package/examples/app1/src/app/projects/projects.component.ts +0 -33
- package/examples/app1/src/app/root/root.component.css +0 -3
- package/examples/app1/src/app/root/root.component.html +0 -16
- package/examples/app1/src/app/root/root.component.ts +0 -35
- package/examples/app1/src/app/services/initialized-data.resolver.ts +0 -15
- package/examples/app1/src/app/shared.module.ts +0 -57
- package/examples/app1/src/app/user/detail/user-detail.component.html +0 -5
- package/examples/app1/src/app/user/detail/user-detail.component.ts +0 -20
- package/examples/app1/src/app/user/user-list.component.html +0 -7
- package/examples/app1/src/app/user/user-list.component.ts +0 -20
- package/examples/app1/src/app/user/user.module.ts +0 -31
- package/examples/app1/src/assets/.gitkeep +0 -0
- package/examples/app1/src/assets/github.png +0 -0
- package/examples/app1/src/assets/main.css +0 -3
- package/examples/app1/src/environments/environment.prod.ts +0 -3
- package/examples/app1/src/environments/environment.ts +0 -16
- package/examples/app1/src/favicon.ico +0 -0
- package/examples/app1/src/index.html +0 -14
- package/examples/app1/src/main.ts +0 -35
- package/examples/app1/src/polyfills.ts +0 -84
- package/examples/app1/src/styles.scss +0 -35
- package/examples/app1/src/test.ts +0 -14
- package/examples/app1/temp.js +0 -221
- package/examples/app1/tsconfig.app.json +0 -10
- package/examples/app1/tsconfig.spec.json +0 -18
- package/examples/app1/tslint.json +0 -17
- package/examples/app1/webpack.config.js +0 -127
- package/examples/app2/browserslist +0 -11
- package/examples/app2/extra-webpack.config.js +0 -32
- package/examples/app2/karma.conf.js +0 -31
- package/examples/app2/src/app/app.module.ts +0 -90
- package/examples/app2/src/app/dashboard/dashboard.component.html +0 -21
- package/examples/app2/src/app/dashboard/dashboard.component.ts +0 -27
- package/examples/app2/src/app/overlay.ts +0 -26
- package/examples/app2/src/app/projects/detail/detail.component.html +0 -16
- package/examples/app2/src/app/projects/detail/detail.component.ts +0 -21
- package/examples/app2/src/app/projects/project-list.component.html +0 -29
- package/examples/app2/src/app/projects/project-list.component.ts +0 -58
- package/examples/app2/src/app/projects/project.resolver.ts +0 -15
- package/examples/app2/src/app/projects/projects.service.ts +0 -28
- package/examples/app2/src/app/projects/tasks/tasks.component.html +0 -10
- package/examples/app2/src/app/projects/tasks/tasks.component.ts +0 -16
- package/examples/app2/src/app/projects/view/view.component.html +0 -1
- package/examples/app2/src/app/projects/view/view.component.ts +0 -20
- package/examples/app2/src/app/root/root.component.html +0 -14
- package/examples/app2/src/app/root/root.component.scss +0 -12
- package/examples/app2/src/app/root/root.component.ts +0 -28
- package/examples/app2/src/app/shared.module.ts +0 -59
- package/examples/app2/src/assets/.gitkeep +0 -0
- package/examples/app2/src/environments/environment.prod.ts +0 -3
- package/examples/app2/src/environments/environment.ts +0 -16
- package/examples/app2/src/favicon.ico +0 -0
- package/examples/app2/src/index.html +0 -14
- package/examples/app2/src/main.ts +0 -36
- package/examples/app2/src/polyfills.ts +0 -84
- package/examples/app2/src/styles.scss +0 -28
- package/examples/app2/src/test.ts +0 -14
- package/examples/app2/tsconfig.app.json +0 -10
- package/examples/app2/tsconfig.spec.json +0 -18
- package/examples/app2/tslint.json +0 -7
- package/examples/app2/webpack.config.js +0 -92
- package/examples/common/app-root-context.ts +0 -10
- package/examples/common/cache.ts +0 -82
- package/examples/common/index.ts +0 -13
- package/examples/common/module.ts +0 -10
- package/examples/common/overlay-container.service.ts +0 -28
- package/examples/common/section-card/section-card.component.html +0 -5
- package/examples/common/section-card/section-card.component.scss +0 -15
- package/examples/common/section-card/section-card.component.ts +0 -11
- package/examples/common/utils.ts +0 -0
- package/examples/portal/src/app/a-detail/a-detail.component.html +0 -8
- package/examples/portal/src/app/a-detail/a-detail.component.ts +0 -18
- package/examples/portal/src/app/about/about.component.html +0 -27
- package/examples/portal/src/app/about/about.component.scss +0 -0
- package/examples/portal/src/app/about/about.component.spec.ts +0 -26
- package/examples/portal/src/app/about/about.component.ts +0 -26
- package/examples/portal/src/app/app-routing.module.ts +0 -57
- package/examples/portal/src/app/app.component.html +0 -73
- package/examples/portal/src/app/app.component.scss +0 -58
- package/examples/portal/src/app/app.component.spec.ts +0 -33
- package/examples/portal/src/app/app.component.ts +0 -111
- package/examples/portal/src/app/app.module.ts +0 -64
- package/examples/portal/src/app/custom-settings.service.ts +0 -44
- package/examples/portal/src/app/overlay.ts +0 -26
- package/examples/portal/src/app/settings/settings.component.html +0 -31
- package/examples/portal/src/app/settings/settings.component.scss +0 -3
- package/examples/portal/src/app/settings/settings.component.ts +0 -43
- package/examples/portal/src/assets/.gitkeep +0 -0
- package/examples/portal/src/assets/apps.json +0 -29
- package/examples/portal/src/assets/icons/sprite.defs.svg +0 -1
- package/examples/portal/src/assets/images/logo.svg +0 -16
- package/examples/portal/src/assets/ngx-planet-micro-front-end.gif +0 -0
- package/examples/portal/src/browserslist +0 -11
- package/examples/portal/src/environments/environment.prod.ts +0 -3
- package/examples/portal/src/environments/environment.ts +0 -16
- package/examples/portal/src/extra-webpack.config.js +0 -32
- package/examples/portal/src/favicon.ico +0 -0
- package/examples/portal/src/index.html +0 -14
- package/examples/portal/src/karma.conf.js +0 -31
- package/examples/portal/src/main.ts +0 -18
- package/examples/portal/src/polyfills.ts +0 -84
- package/examples/portal/src/reboot.scss +0 -14
- package/examples/portal/src/styles.scss +0 -14
- package/examples/portal/src/test.ts +0 -14
- package/examples/portal/src/tsconfig.app.json +0 -10
- package/examples/portal/src/tsconfig.spec.json +0 -9
- package/examples/portal/src/tslint.json +0 -7
- package/extra-webpack.config.js +0 -5
- package/nginx.conf +0 -17
- package/packages/planet/karma.conf.js +0 -37
- package/packages/planet/ng-package.json +0 -7
- package/packages/planet/package.json +0 -10
- package/packages/planet/src/application/planet-application-loader.spec.ts +0 -1102
- package/packages/planet/src/application/planet-application-loader.ts +0 -549
- package/packages/planet/src/application/planet-application-ref.spec.ts +0 -233
- package/packages/planet/src/application/planet-application-ref.ts +0 -131
- package/packages/planet/src/application/planet-application.service.spec.ts +0 -145
- package/packages/planet/src/application/planet-application.service.ts +0 -88
- package/packages/planet/src/application/portal-application.spec.ts +0 -53
- package/packages/planet/src/assets-loader.spec.ts +0 -689
- package/packages/planet/src/assets-loader.ts +0 -247
- package/packages/planet/src/component/planet-component-loader.spec.ts +0 -187
- package/packages/planet/src/component/planet-component-loader.ts +0 -173
- package/packages/planet/src/component/planet-component-ref.ts +0 -8
- package/packages/planet/src/debug.spec.ts +0 -58
- package/packages/planet/src/debug.ts +0 -66
- package/packages/planet/src/empty/empty.component.spec.ts +0 -34
- package/packages/planet/src/empty/empty.component.ts +0 -7
- package/packages/planet/src/global-event-dispatcher.spec.ts +0 -81
- package/packages/planet/src/global-event-dispatcher.ts +0 -82
- package/packages/planet/src/global-planet.spec.ts +0 -39
- package/packages/planet/src/global-planet.ts +0 -73
- package/packages/planet/src/helpers.spec.ts +0 -242
- package/packages/planet/src/helpers.ts +0 -125
- package/packages/planet/src/module.spec.ts +0 -79
- package/packages/planet/src/module.ts +0 -25
- package/packages/planet/src/planet.spec.ts +0 -226
- package/packages/planet/src/planet.ts +0 -113
- package/packages/planet/src/sandbox/constants.ts +0 -6
- package/packages/planet/src/sandbox/exec.ts +0 -22
- package/packages/planet/src/sandbox/index.ts +0 -24
- package/packages/planet/src/sandbox/proxy/patches/document.ts +0 -13
- package/packages/planet/src/sandbox/proxy/patches/eventListener.ts +0 -49
- package/packages/planet/src/sandbox/proxy/patches/index.ts +0 -13
- package/packages/planet/src/sandbox/proxy/patches/storage.ts +0 -53
- package/packages/planet/src/sandbox/proxy/patches/timer.ts +0 -50
- package/packages/planet/src/sandbox/proxy/proxies/common.ts +0 -137
- package/packages/planet/src/sandbox/proxy/proxies/document.ts +0 -140
- package/packages/planet/src/sandbox/proxy/proxies/window.ts +0 -176
- package/packages/planet/src/sandbox/proxy/proxy-sandbox.ts +0 -59
- package/packages/planet/src/sandbox/sandbox.ts +0 -20
- package/packages/planet/src/sandbox/snapshot/snapshot-sandbox.ts +0 -12
- package/packages/planet/src/sandbox/types.ts +0 -1
- package/packages/planet/src/test.ts +0 -16
- package/packages/planet/src/testing/app1.module.ts +0 -34
- package/packages/planet/src/testing/app2.module.ts +0 -24
- package/packages/planet/src/testing/applications.ts +0 -58
- package/packages/planet/src/testing/index.ts +0 -2
- package/packages/planet/src/testing/utils.ts +0 -31
- package/packages/planet/tsconfig.lib.json +0 -27
- package/packages/planet/tsconfig.lib.prod.json +0 -9
- package/packages/planet/tsconfig.spec.json +0 -17
- package/packages/planet/tslint.json +0 -7
- package/postcss.config.js +0 -3
- package/proxy.conf.js +0 -15
- package/tsconfig.json +0 -23
- package/tslint.json +0 -80
|
@@ -1,549 +0,0 @@
|
|
|
1
|
-
import { Injectable, NgZone, ApplicationRef, Injector } from '@angular/core';
|
|
2
|
-
import { of, Observable, Subject, forkJoin, from, throwError } from 'rxjs';
|
|
3
|
-
import { AssetsLoader } from '../assets-loader';
|
|
4
|
-
import { PlanetApplication, PlanetRouterEvent, SwitchModes, PlanetOptions } from '../planet.class';
|
|
5
|
-
import { switchMap, share, map, tap, distinctUntilChanged, take, filter, catchError } from 'rxjs/operators';
|
|
6
|
-
import { getHTMLElement, coerceArray, createElementByTemplate } from '../helpers';
|
|
7
|
-
import { PlanetApplicationRef } from './planet-application-ref';
|
|
8
|
-
import { PlanetPortalApplication } from './portal-application';
|
|
9
|
-
import { PlanetApplicationService } from './planet-application.service';
|
|
10
|
-
import { GlobalEventDispatcher } from '../global-event-dispatcher';
|
|
11
|
-
import { Router } from '@angular/router';
|
|
12
|
-
import { globalPlanet, getPlanetApplicationRef, getApplicationLoader } from '../global-planet';
|
|
13
|
-
import { createDebug } from '../debug';
|
|
14
|
-
const debug = createDebug('app-loader');
|
|
15
|
-
|
|
16
|
-
export enum ApplicationStatus {
|
|
17
|
-
assetsLoading = 1,
|
|
18
|
-
assetsLoaded = 2,
|
|
19
|
-
bootstrapping = 3,
|
|
20
|
-
bootstrapped = 4,
|
|
21
|
-
active = 5,
|
|
22
|
-
loadError = 10
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface AppsLoadingStartEvent {
|
|
26
|
-
shouldLoadApps: PlanetApplication[];
|
|
27
|
-
shouldUnloadApps: PlanetApplication[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface AppStatusChangeEvent {
|
|
31
|
-
app: PlanetApplication;
|
|
32
|
-
status: ApplicationStatus;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@Injectable({
|
|
36
|
-
providedIn: 'root'
|
|
37
|
-
})
|
|
38
|
-
export class PlanetApplicationLoader {
|
|
39
|
-
private firstLoad = true;
|
|
40
|
-
|
|
41
|
-
private startRouteChangeEvent!: PlanetRouterEvent;
|
|
42
|
-
|
|
43
|
-
private options: PlanetOptions;
|
|
44
|
-
|
|
45
|
-
private inProgressAppAssetsLoads = new Map<string, Observable<PlanetApplication>>();
|
|
46
|
-
|
|
47
|
-
private appsStatus = new Map<PlanetApplication, ApplicationStatus>();
|
|
48
|
-
|
|
49
|
-
private portalApp = new PlanetPortalApplication();
|
|
50
|
-
|
|
51
|
-
private routeChange$ = new Subject<PlanetRouterEvent>();
|
|
52
|
-
|
|
53
|
-
private appStatusChange$ = new Subject<AppStatusChangeEvent>();
|
|
54
|
-
|
|
55
|
-
private appsLoadingStart$ = new Subject<AppsLoadingStartEvent>();
|
|
56
|
-
|
|
57
|
-
public get appStatusChange(): Observable<AppStatusChangeEvent> {
|
|
58
|
-
return this.appStatusChange$.asObservable();
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public get appsLoadingStart(): Observable<AppsLoadingStartEvent> {
|
|
62
|
-
return this.appsLoadingStart$.asObservable();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public loadingDone = false;
|
|
66
|
-
|
|
67
|
-
constructor(
|
|
68
|
-
private assetsLoader: AssetsLoader,
|
|
69
|
-
private planetApplicationService: PlanetApplicationService,
|
|
70
|
-
private ngZone: NgZone,
|
|
71
|
-
router: Router,
|
|
72
|
-
injector: Injector,
|
|
73
|
-
applicationRef: ApplicationRef
|
|
74
|
-
) {
|
|
75
|
-
if (getApplicationLoader()) {
|
|
76
|
-
throw new Error(
|
|
77
|
-
'PlanetApplicationLoader has been injected in the portal, repeated injection is not allowed'
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
this.options = {
|
|
82
|
-
switchMode: SwitchModes.default,
|
|
83
|
-
errorHandler: (error: Error) => {
|
|
84
|
-
console.error(error);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
this.portalApp.ngZone = ngZone;
|
|
88
|
-
this.portalApp.applicationRef = applicationRef;
|
|
89
|
-
this.portalApp.router = router;
|
|
90
|
-
this.portalApp.injector = injector;
|
|
91
|
-
this.portalApp.globalEventDispatcher = injector.get(GlobalEventDispatcher);
|
|
92
|
-
globalPlanet.portalApplication = this.portalApp;
|
|
93
|
-
this.setupRouteChange();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
private setAppStatus(app: PlanetApplication, status: ApplicationStatus) {
|
|
97
|
-
this.ngZone.run(() => {
|
|
98
|
-
const fromStatus = this.appsStatus.get(app);
|
|
99
|
-
debug(
|
|
100
|
-
`app(${app.name}) status change: ${fromStatus ? ApplicationStatus[fromStatus] : 'empty'} => ${
|
|
101
|
-
ApplicationStatus[status]
|
|
102
|
-
}`
|
|
103
|
-
);
|
|
104
|
-
this.appsStatus.set(app, status);
|
|
105
|
-
this.appStatusChange$.next({
|
|
106
|
-
app: app,
|
|
107
|
-
status: status
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
private getAppStatusChange$(
|
|
113
|
-
app: PlanetApplication,
|
|
114
|
-
status = ApplicationStatus.bootstrapped
|
|
115
|
-
): Observable<PlanetApplication> {
|
|
116
|
-
return this.appStatusChange.pipe(
|
|
117
|
-
filter(event => {
|
|
118
|
-
return event.app === app && event.status === status;
|
|
119
|
-
}),
|
|
120
|
-
map(() => {
|
|
121
|
-
return app;
|
|
122
|
-
})
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
private switchModeIsCoexist(app: PlanetApplication) {
|
|
127
|
-
if (app && app.switchMode) {
|
|
128
|
-
return app.switchMode === SwitchModes.coexist;
|
|
129
|
-
} else {
|
|
130
|
-
return this.options.switchMode === SwitchModes.coexist;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
private errorHandler(error: Error) {
|
|
135
|
-
this.ngZone.run(() => {
|
|
136
|
-
this.options.errorHandler(error);
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
private setLoadingDone() {
|
|
141
|
-
this.ngZone.run(() => {
|
|
142
|
-
this.loadingDone = true;
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
private getAppNames(apps: PlanetApplication[]): string | string[] {
|
|
147
|
-
return apps.length === 0
|
|
148
|
-
? `[]`
|
|
149
|
-
: apps.map(item => {
|
|
150
|
-
return item.name;
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
private setupRouteChange() {
|
|
155
|
-
this.routeChange$
|
|
156
|
-
.pipe(
|
|
157
|
-
distinctUntilChanged((x, y) => {
|
|
158
|
-
return (x && x.url) === (y && y.url);
|
|
159
|
-
}),
|
|
160
|
-
// Using switchMap so we cancel executing loading when a new one comes in
|
|
161
|
-
switchMap(event => {
|
|
162
|
-
// Return new observable use of and catchError,
|
|
163
|
-
// in order to prevent routeChange$ completed which never trigger new route change
|
|
164
|
-
return of(event).pipe(
|
|
165
|
-
// unload apps and return should load apps
|
|
166
|
-
map(() => {
|
|
167
|
-
debug(`route change, url is: ${event.url}`);
|
|
168
|
-
this.startRouteChangeEvent = event;
|
|
169
|
-
const shouldLoadApps = this.planetApplicationService.getAppsByMatchedUrl(event.url);
|
|
170
|
-
debug(`should load apps: ${this.getAppNames(shouldLoadApps)}`);
|
|
171
|
-
const shouldUnloadApps = this.getUnloadApps(shouldLoadApps);
|
|
172
|
-
this.appsLoadingStart$.next({
|
|
173
|
-
shouldLoadApps,
|
|
174
|
-
shouldUnloadApps
|
|
175
|
-
});
|
|
176
|
-
this.unloadApps(shouldUnloadApps, event);
|
|
177
|
-
debug(`unload apps: ${this.getAppNames(shouldUnloadApps)}`);
|
|
178
|
-
return shouldLoadApps;
|
|
179
|
-
}),
|
|
180
|
-
// Load app assets (static resources)
|
|
181
|
-
switchMap(shouldLoadApps => {
|
|
182
|
-
let hasAppsNeedLoadingAssets = false;
|
|
183
|
-
const loadApps$ = shouldLoadApps.map(app => {
|
|
184
|
-
const appStatus = this.appsStatus.get(app);
|
|
185
|
-
if (
|
|
186
|
-
!appStatus ||
|
|
187
|
-
appStatus === ApplicationStatus.assetsLoading ||
|
|
188
|
-
appStatus === ApplicationStatus.loadError
|
|
189
|
-
) {
|
|
190
|
-
debug(
|
|
191
|
-
`app(${app.name}) status is ${
|
|
192
|
-
ApplicationStatus[appStatus as ApplicationStatus]
|
|
193
|
-
}, start load assets`
|
|
194
|
-
);
|
|
195
|
-
hasAppsNeedLoadingAssets = true;
|
|
196
|
-
return this.ngZone.runOutsideAngular(() => {
|
|
197
|
-
return this.startLoadAppAssets(app);
|
|
198
|
-
});
|
|
199
|
-
} else {
|
|
200
|
-
return of(app);
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
if (hasAppsNeedLoadingAssets) {
|
|
204
|
-
this.loadingDone = false;
|
|
205
|
-
}
|
|
206
|
-
return loadApps$.length > 0 ? forkJoin(loadApps$) : of([] as PlanetApplication[]);
|
|
207
|
-
}),
|
|
208
|
-
// Bootstrap or show apps
|
|
209
|
-
map(apps => {
|
|
210
|
-
const apps$: Observable<PlanetApplication>[] = apps.map(app => {
|
|
211
|
-
return of(app).pipe(
|
|
212
|
-
switchMap(app => {
|
|
213
|
-
const appStatus = this.appsStatus.get(app);
|
|
214
|
-
if (appStatus === ApplicationStatus.bootstrapped) {
|
|
215
|
-
debug(
|
|
216
|
-
`[routeChange] app(${app.name}) status is bootstrapped, show app and active`
|
|
217
|
-
);
|
|
218
|
-
this.showApp(app);
|
|
219
|
-
const appRef = getPlanetApplicationRef(app.name);
|
|
220
|
-
appRef?.navigateByUrl(event.url);
|
|
221
|
-
this.setAppStatus(app, ApplicationStatus.active);
|
|
222
|
-
this.setLoadingDone();
|
|
223
|
-
return of(app);
|
|
224
|
-
} else if (appStatus === ApplicationStatus.assetsLoaded) {
|
|
225
|
-
debug(
|
|
226
|
-
`[routeChange] app(${app.name}) status is assetsLoaded, start bootstrapping`
|
|
227
|
-
);
|
|
228
|
-
return this.bootstrapApp(app).pipe(
|
|
229
|
-
map(() => {
|
|
230
|
-
debug(`app(${app.name}) bootstrapped success, active it`);
|
|
231
|
-
this.setAppStatus(app, ApplicationStatus.active);
|
|
232
|
-
this.setLoadingDone();
|
|
233
|
-
return app;
|
|
234
|
-
})
|
|
235
|
-
);
|
|
236
|
-
} else if (appStatus === ApplicationStatus.active) {
|
|
237
|
-
debug(`[routeChange] app(${app.name}) is active, do nothings`);
|
|
238
|
-
const appRef = getPlanetApplicationRef(app.name);
|
|
239
|
-
// Backwards compatibility sub app use old version which has not getCurrentRouterStateUrl
|
|
240
|
-
const currentUrl = appRef?.getCurrentRouterStateUrl
|
|
241
|
-
? appRef.getCurrentRouterStateUrl()
|
|
242
|
-
: '';
|
|
243
|
-
if (currentUrl !== event.url) {
|
|
244
|
-
appRef?.navigateByUrl(event.url);
|
|
245
|
-
}
|
|
246
|
-
return of(app);
|
|
247
|
-
} else {
|
|
248
|
-
debug(
|
|
249
|
-
`[routeChange] app(${app.name}) status is ${
|
|
250
|
-
ApplicationStatus[appStatus as ApplicationStatus]
|
|
251
|
-
}`
|
|
252
|
-
);
|
|
253
|
-
return this.getAppStatusChange$(app).pipe(
|
|
254
|
-
take(1),
|
|
255
|
-
map(() => {
|
|
256
|
-
debug(
|
|
257
|
-
`app(${app.name}) status is bootstrapped by subscribe status change, active it`
|
|
258
|
-
);
|
|
259
|
-
this.setAppStatus(app, ApplicationStatus.active);
|
|
260
|
-
this.showApp(app);
|
|
261
|
-
return app;
|
|
262
|
-
})
|
|
263
|
-
);
|
|
264
|
-
}
|
|
265
|
-
})
|
|
266
|
-
);
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
if (apps$.length > 0) {
|
|
270
|
-
debug(`start load and active apps: ${this.getAppNames(apps)}`);
|
|
271
|
-
// 切换到应用后会有闪烁现象,所以使用 setTimeout 后启动应用
|
|
272
|
-
// example: redirect to app1's dashboard from portal's about page
|
|
273
|
-
// If app's route has redirect, it doesn't work, it ok just in setTimeout, I don't know why.
|
|
274
|
-
// TODO:: remove it, it is ok in version Angular 9.x
|
|
275
|
-
setTimeout(() => {
|
|
276
|
-
// 此处判断是因为如果静态资源加载完毕还未启动被取消,还是会启动之前的应用,虽然可能性比较小,但是无法排除这种可能性,所以只有当 Event 是最后一个才会启动
|
|
277
|
-
if (this.startRouteChangeEvent === event) {
|
|
278
|
-
// runOutsideAngular for fix error: `Expected to not be in Angular Zone, but it is!`
|
|
279
|
-
this.ngZone.runOutsideAngular(() => {
|
|
280
|
-
forkJoin(apps$).subscribe(() => {
|
|
281
|
-
this.setLoadingDone();
|
|
282
|
-
this.ensurePreloadApps(apps);
|
|
283
|
-
});
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
} else {
|
|
288
|
-
debug(`no apps need to be loaded, ensure preload apps`);
|
|
289
|
-
this.ensurePreloadApps(apps);
|
|
290
|
-
this.setLoadingDone();
|
|
291
|
-
}
|
|
292
|
-
}),
|
|
293
|
-
// Error handler
|
|
294
|
-
catchError(error => {
|
|
295
|
-
debug(`apps loader error: ${error}`);
|
|
296
|
-
this.errorHandler(error);
|
|
297
|
-
return [];
|
|
298
|
-
})
|
|
299
|
-
);
|
|
300
|
-
})
|
|
301
|
-
)
|
|
302
|
-
.subscribe();
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
private startLoadAppAssets(app: PlanetApplication): Observable<PlanetApplication> {
|
|
306
|
-
if (this.inProgressAppAssetsLoads.get(app.name)) {
|
|
307
|
-
return this.inProgressAppAssetsLoads.get(app.name);
|
|
308
|
-
} else {
|
|
309
|
-
const loadApp$ = this.assetsLoader.loadAppAssets(app).pipe(
|
|
310
|
-
tap(() => {
|
|
311
|
-
this.inProgressAppAssetsLoads.delete(app.name);
|
|
312
|
-
this.setAppStatus(app, ApplicationStatus.assetsLoaded);
|
|
313
|
-
}),
|
|
314
|
-
map(() => {
|
|
315
|
-
return app;
|
|
316
|
-
}),
|
|
317
|
-
catchError(error => {
|
|
318
|
-
this.inProgressAppAssetsLoads.delete(app.name);
|
|
319
|
-
this.setAppStatus(app, ApplicationStatus.loadError);
|
|
320
|
-
throw error;
|
|
321
|
-
}),
|
|
322
|
-
share()
|
|
323
|
-
);
|
|
324
|
-
this.inProgressAppAssetsLoads.set(app.name, loadApp$);
|
|
325
|
-
this.setAppStatus(app, ApplicationStatus.assetsLoading);
|
|
326
|
-
return loadApp$;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
private hideApp(planetApp: PlanetApplication) {
|
|
331
|
-
const appRef = getPlanetApplicationRef(planetApp.name);
|
|
332
|
-
const appRootElement = document.querySelector(appRef?.selector || (planetApp.selector as string));
|
|
333
|
-
if (appRootElement) {
|
|
334
|
-
appRootElement.setAttribute('style', 'display:none;');
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
private showApp(planetApp: PlanetApplication) {
|
|
339
|
-
const appRef = getPlanetApplicationRef(planetApp.name);
|
|
340
|
-
const appRootElement = document.querySelector(appRef?.selector || (planetApp.selector as string));
|
|
341
|
-
if (appRootElement) {
|
|
342
|
-
appRootElement.setAttribute('style', '');
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
private destroyApp(planetApp: PlanetApplication) {
|
|
347
|
-
const appRef = getPlanetApplicationRef(planetApp.name);
|
|
348
|
-
if (appRef) {
|
|
349
|
-
appRef.destroy();
|
|
350
|
-
}
|
|
351
|
-
const container = getHTMLElement(planetApp.hostParent);
|
|
352
|
-
const appRootElement = container?.querySelector((appRef && appRef.selector) || (planetApp.selector as string));
|
|
353
|
-
if (appRootElement) {
|
|
354
|
-
container?.removeChild(appRootElement);
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
private bootstrapApp(
|
|
359
|
-
app: PlanetApplication,
|
|
360
|
-
defaultStatus: 'hidden' | 'display' = 'display'
|
|
361
|
-
): Observable<PlanetApplicationRef> {
|
|
362
|
-
debug(`app(${app.name}) start bootstrapping`);
|
|
363
|
-
this.setAppStatus(app, ApplicationStatus.bootstrapping);
|
|
364
|
-
const appRef = getPlanetApplicationRef(app.name);
|
|
365
|
-
if (appRef && appRef.bootstrap) {
|
|
366
|
-
const container = getHTMLElement(app.hostParent);
|
|
367
|
-
let appRootElement: HTMLElement;
|
|
368
|
-
if (container) {
|
|
369
|
-
appRootElement = container.querySelector(appRef.selector || app.selector!)!;
|
|
370
|
-
if (!appRootElement) {
|
|
371
|
-
if (appRef.template) {
|
|
372
|
-
appRootElement = createElementByTemplate(appRef.template)!;
|
|
373
|
-
} else {
|
|
374
|
-
appRootElement = document.createElement(app.selector!);
|
|
375
|
-
}
|
|
376
|
-
appRootElement.setAttribute('style', 'display:none;');
|
|
377
|
-
if (app.hostClass) {
|
|
378
|
-
appRootElement.classList.add(...coerceArray(app.hostClass));
|
|
379
|
-
}
|
|
380
|
-
if (app.stylePrefix) {
|
|
381
|
-
appRootElement.classList.add(...coerceArray(app.stylePrefix));
|
|
382
|
-
}
|
|
383
|
-
container.appendChild(appRootElement);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
let result = appRef.bootstrap(this.portalApp);
|
|
387
|
-
// Backwards compatibility promise for bootstrap
|
|
388
|
-
if ((result as any)['then']) {
|
|
389
|
-
result = from(result) as Observable<PlanetApplicationRef>;
|
|
390
|
-
}
|
|
391
|
-
return result.pipe(
|
|
392
|
-
tap(() => {
|
|
393
|
-
debug(`app(${app.name}) bootstrapped success for ${defaultStatus}`);
|
|
394
|
-
this.setAppStatus(app, ApplicationStatus.bootstrapped);
|
|
395
|
-
if (defaultStatus === 'display' && appRootElement) {
|
|
396
|
-
appRootElement.removeAttribute('style');
|
|
397
|
-
}
|
|
398
|
-
}),
|
|
399
|
-
map(() => {
|
|
400
|
-
return appRef;
|
|
401
|
-
})
|
|
402
|
-
);
|
|
403
|
-
} else {
|
|
404
|
-
throw new Error(
|
|
405
|
-
`[${app.name}] not found, make sure that the app has the correct name defined use defineApplication(${app.name}) and runtimeChunk and vendorChunk are set to true, details see https://github.com/worktile/ngx-planet#throw-error-cannot-read-property-call-of-undefined-at-__webpack_require__-bootstrap79`
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
private getUnloadApps(activeApps: PlanetApplication[]) {
|
|
411
|
-
const unloadApps: PlanetApplication[] = [];
|
|
412
|
-
this.appsStatus.forEach((value, app) => {
|
|
413
|
-
if (value === ApplicationStatus.active && !activeApps.find(item => item.name === app.name)) {
|
|
414
|
-
unloadApps.push(app);
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
return unloadApps;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
private unloadApps(shouldUnloadApps: PlanetApplication[], event: PlanetRouterEvent) {
|
|
421
|
-
const hideApps: PlanetApplication[] = [];
|
|
422
|
-
const destroyApps: PlanetApplication[] = [];
|
|
423
|
-
shouldUnloadApps.forEach(app => {
|
|
424
|
-
if (this.switchModeIsCoexist(app)) {
|
|
425
|
-
debug(`hide app(${app.name}) for coexist mode`);
|
|
426
|
-
hideApps.push(app);
|
|
427
|
-
this.hideApp(app);
|
|
428
|
-
this.setAppStatus(app, ApplicationStatus.bootstrapped);
|
|
429
|
-
} else {
|
|
430
|
-
destroyApps.push(app);
|
|
431
|
-
// 销毁之前先隐藏,否则会出现闪烁,因为 destroy 是延迟执行的
|
|
432
|
-
// 如果销毁不延迟执行,会出现切换到主应用的时候会有视图卡顿现象
|
|
433
|
-
this.hideApp(app);
|
|
434
|
-
this.setAppStatus(app, ApplicationStatus.assetsLoaded);
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
if (hideApps.length > 0 || destroyApps.length > 0) {
|
|
439
|
-
// 从其他应用切换到主应用的时候会有视图卡顿现象,所以先等主应用渲染完毕后再加载其他应用
|
|
440
|
-
// 此处尝试使用 this.ngZone.onStable.pipe(take(1)) 应用之间的切换会出现闪烁
|
|
441
|
-
setTimeout(() => {
|
|
442
|
-
hideApps.forEach(app => {
|
|
443
|
-
const appRef = getPlanetApplicationRef(app.name);
|
|
444
|
-
if (appRef) {
|
|
445
|
-
appRef.navigateByUrl(event.url);
|
|
446
|
-
}
|
|
447
|
-
});
|
|
448
|
-
destroyApps.forEach(app => {
|
|
449
|
-
debug(`destroy app(${app.name})`);
|
|
450
|
-
this.destroyApp(app);
|
|
451
|
-
});
|
|
452
|
-
});
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
private preloadApps(activeApps?: PlanetApplication[]) {
|
|
457
|
-
setTimeout(() => {
|
|
458
|
-
const toPreloadApps = this.planetApplicationService.getAppsToPreload(
|
|
459
|
-
activeApps ? activeApps.map(item => item.name) : undefined
|
|
460
|
-
);
|
|
461
|
-
debug(`start preload apps: ${this.getAppNames(toPreloadApps)}`);
|
|
462
|
-
const loadApps$ = toPreloadApps.map(preloadApp => {
|
|
463
|
-
return this.preloadInternal(preloadApp);
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
forkJoin(loadApps$).subscribe({
|
|
467
|
-
error: error => {
|
|
468
|
-
this.errorHandler(error);
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
private ensurePreloadApps(activeApps?: PlanetApplication[]) {
|
|
475
|
-
// Start preload apps
|
|
476
|
-
// Start preload when first time app loaded
|
|
477
|
-
if (this.firstLoad) {
|
|
478
|
-
this.preloadApps(activeApps);
|
|
479
|
-
this.firstLoad = false;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
public setOptions(options: Partial<PlanetOptions>) {
|
|
484
|
-
this.options = {
|
|
485
|
-
...this.options,
|
|
486
|
-
...options
|
|
487
|
-
};
|
|
488
|
-
}
|
|
489
|
-
|
|
490
|
-
/**
|
|
491
|
-
* reset route by current router
|
|
492
|
-
*/
|
|
493
|
-
public reroute(event: PlanetRouterEvent) {
|
|
494
|
-
this.routeChange$.next(event);
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
private preloadInternal(app: PlanetApplication, immediate?: boolean): Observable<PlanetApplicationRef | null> {
|
|
498
|
-
const status = this.appsStatus.get(app);
|
|
499
|
-
if (!status || status === ApplicationStatus.loadError) {
|
|
500
|
-
debug(`preload app(${app.name}), status is empty, start to load assets`);
|
|
501
|
-
return this.startLoadAppAssets(app).pipe(
|
|
502
|
-
switchMap(() => {
|
|
503
|
-
debug(`preload app(${app.name}), assets loaded, start bootstrap app, immediate: ${!!immediate}`);
|
|
504
|
-
if (immediate) {
|
|
505
|
-
return this.bootstrapApp(app, 'hidden');
|
|
506
|
-
} else {
|
|
507
|
-
return this.ngZone.runOutsideAngular(() => {
|
|
508
|
-
return this.bootstrapApp(app, 'hidden');
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
}),
|
|
512
|
-
catchError(error => {
|
|
513
|
-
this.errorHandler(error);
|
|
514
|
-
return of(null);
|
|
515
|
-
}),
|
|
516
|
-
map(() => {
|
|
517
|
-
return getPlanetApplicationRef(app.name);
|
|
518
|
-
})
|
|
519
|
-
);
|
|
520
|
-
} else if (
|
|
521
|
-
[ApplicationStatus.assetsLoading, ApplicationStatus.assetsLoaded, ApplicationStatus.bootstrapping].includes(
|
|
522
|
-
status
|
|
523
|
-
)
|
|
524
|
-
) {
|
|
525
|
-
debug(`preload app(${app.name}), status is ${ApplicationStatus[status]}, return until bootstrapped`);
|
|
526
|
-
return this.getAppStatusChange$(app).pipe(
|
|
527
|
-
take(1),
|
|
528
|
-
map(() => {
|
|
529
|
-
return getPlanetApplicationRef(app.name);
|
|
530
|
-
})
|
|
531
|
-
);
|
|
532
|
-
} else {
|
|
533
|
-
const appRef = getPlanetApplicationRef(app.name);
|
|
534
|
-
if (!appRef) {
|
|
535
|
-
throw new Error(`${app.name}'s status is ${ApplicationStatus[status]}, planetApplicationRef is null.`);
|
|
536
|
-
}
|
|
537
|
-
return of(appRef);
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
/**
|
|
542
|
-
* Preload planet application
|
|
543
|
-
* @param app app
|
|
544
|
-
* @param immediate bootstrap on stable by default, setting immediate is true, it will bootstrap immediate
|
|
545
|
-
*/
|
|
546
|
-
public preload(app: PlanetApplication, immediate?: boolean): Observable<PlanetApplicationRef> {
|
|
547
|
-
return this.preloadInternal(app, immediate);
|
|
548
|
-
}
|
|
549
|
-
}
|