@wolkabout/commons 0.0.8 → 0.0.10
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.
|
@@ -424,18 +424,18 @@ const createGlobalPermissionsGuard = (availableRoutesGetter, fallbackRoute, pare
|
|
|
424
424
|
|
|
425
425
|
class FeatureRegistry {
|
|
426
426
|
injector = inject(Injector);
|
|
427
|
-
_features = new BehaviorSubject([]);
|
|
427
|
+
_features$ = new BehaviorSubject([]);
|
|
428
428
|
registerFeature(feature) {
|
|
429
429
|
runInInjectionContext(this.injector, () => feature.init?.());
|
|
430
|
-
this._features
|
|
430
|
+
this._features$.next([...this._features$.value, feature].sort((a, b) => a.order - b.order));
|
|
431
431
|
}
|
|
432
432
|
loadExternalFeatures(features) {
|
|
433
|
-
forkJoin(features.map(externalFeature => from(loadRemoteModule(externalFeature.remote, externalFeature.
|
|
433
|
+
forkJoin(features.map(externalFeature => from(loadRemoteModule(externalFeature.remote, externalFeature.feature)).pipe(map(module => module.default), catchError(() => of(null))))).pipe(map(list => list.filter((x) => x !== null))).subscribe((externalFeatures) => {
|
|
434
434
|
externalFeatures.forEach(feature => this.registerFeature(feature));
|
|
435
435
|
});
|
|
436
436
|
}
|
|
437
|
-
get features() {
|
|
438
|
-
return this._features
|
|
437
|
+
get features$() {
|
|
438
|
+
return this._features$.asObservable();
|
|
439
439
|
}
|
|
440
440
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FeatureRegistry, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
441
441
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: FeatureRegistry, providedIn: 'root' });
|