Compare commits

..

No commits in common. "fb8129148dc9e3ded6fdf7c5edcd4e488ba58a1a" and "6367d3399d15d9410db24f2a3b91576fba7e6894" have entirely different histories.

2 changed files with 1 additions and 34 deletions

View File

@ -30,7 +30,6 @@ import { NgbDateNativeAdapter } from './services/date-adapter.service'
import { AuthConfigFactory } from './shared/authconfigFactory';
import { StateSerializerService } from './services/state-serializer.service';
import { PackageService } from './services/package.service';
import { PackagePreloadStartegy } from './services/package-preload-strategy.service';
import { SenmlService } from './services/senml-service';
export {
@ -54,8 +53,7 @@ export {
StateSerializerService,
SchemaService,
PackageService,
SenmlService,
PackagePreloadStartegy
SenmlService
};
@NgModule({

View File

@ -1,31 +0,0 @@
import { Injectable} from '@angular/core';
import { PreloadingStrategy,Route } from '@angular/router'
import { Observable, EMPTY } from 'rxjs';
import { PackageService} from './package.service';
@Injectable({
providedIn: 'root',
})
export class PackagePreloadStartegy extends PreloadingStrategy {
loading = new Set<Route>();
constructor(private packageService$:PackageService) {
super();
}
preload(route: Route, load: Function): Observable<any> {
if (this.loading.has(route)) {
// Don't preload the same route twice
return EMPTY;
}
if(route.data && route.data.package) {
if(this.packageService$.hasPackage(route.data.package)) {
console.debug(`Load module for package ${route.data.package}`)
this.loading.add(route);
return load()
}
}
return EMPTY;
}
}