Skip to content

Commit 7f9e56f

Browse files
committed
2 parents 8a997a9 + bd1cd1b commit 7f9e56f

File tree

2 files changed

+11
-37
lines changed

2 files changed

+11
-37
lines changed

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# ngx-planet [![CircleCI](https://circleci.com/gh/worktile/ngx-planet.svg?style=svg)](https://circleci.com/gh/worktile/ngx-planet)
1+
# ngx-planet [![CircleCI](https://circleci.com/gh/worktile/ngx-planet.svg?style=shield)](https://circleci.com/gh/worktile/ngx-planet) [![npm (scoped)](https://img.shields.io/npm/v/@worktile/planet?style=plastic)](https://www.npmjs.com/package/@worktile/planet) [![npm](https://img.shields.io/npm/dm/@worktile/planet)](https://www.npmjs.com/package/@worktile/planet)
22

33
An Angular 7+ Micro Frontend library.
44

55
## Installation
66

77
```
8-
npm i @worktile/planet --save
8+
npm i @worktile/ngx-planet --save
99
```
1010

1111
## Demo
@@ -95,11 +95,7 @@ export class AppComponent implements OnInit {
9595
}
9696
]);
9797
98-
this.router.events.subscribe((event: RouterEvent) => {
99-
if (event instanceof NavigationEnd) {
100-
this.planet.resetRouting(event);
101-
}
102-
});
98+
this.planet.start();
10399
104100
this.globalEventDispatcher.register('openADetail').subscribe(event => {
105101
// open a Detail
@@ -132,13 +128,14 @@ defineApplication('app1', (portalApp: PlanetPortalApplication) => {
132128
## Development
133129

134130
```
131+
npm start open http://localhost:3000
132+
133+
or
134+
135135
npm run serve:portal // 3000
136136
npm run serve:app1 // 3001
137137
npm run serve:app2 // 3002
138138
139-
or
140-
141-
npm start
139+
// test
140+
npm run test
142141
```
143-
144-
open http://localhost:3000

packages/planet/src/application/planet-application.service.ts

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@ import { coerceArray, getScriptsAndStylesFullPaths } from '../helpers';
66
import { Observable, of } from 'rxjs';
77
import { AssetsLoadResult, AssetsLoader } from '../assets-loader';
88

9-
interface InternalPlanetApplication extends PlanetApplication {
10-
loaded?: boolean;
11-
}
12-
139
@Injectable({
1410
providedIn: 'root'
1511
})
1612
export class PlanetApplicationService {
17-
private apps: InternalPlanetApplication[] = [];
13+
private apps: PlanetApplication[] = [];
1814

19-
private appsMap: { [key: string]: InternalPlanetApplication } = {};
20-
21-
private currentApps: InternalPlanetApplication[] = [];
15+
private appsMap: { [key: string]: PlanetApplication } = {};
2216

2317
constructor(private http: HttpClient, private assetsLoader: AssetsLoader) {}
2418

@@ -85,21 +79,4 @@ export class PlanetApplicationService {
8579
getApps() {
8680
return this.apps;
8781
}
88-
89-
loadApp(app: InternalPlanetApplication): Observable<[AssetsLoadResult[], AssetsLoadResult[]]> {
90-
if (app.loaded) {
91-
return of(null);
92-
}
93-
if (app.manifest) {
94-
return this.assetsLoader.loadManifest(`${app.manifest}?t=${new Date().getTime()}`).pipe(
95-
switchMap(manifestResult => {
96-
const { scripts, styles } = getScriptsAndStylesFullPaths(app, manifestResult);
97-
return this.assetsLoader.loadScriptsAndStyles(scripts, styles, app.loadSerial);
98-
})
99-
);
100-
} else {
101-
const { scripts, styles } = getScriptsAndStylesFullPaths(app);
102-
return this.assetsLoader.loadScriptsAndStyles(scripts, styles, app.loadSerial);
103-
}
104-
}
10582
}

0 commit comments

Comments
 (0)