navigation/ts/navigationmanager.ts

27 lines
923 B
TypeScript
Raw Normal View History

2021-08-08 21:06:14 +00:00
import { CompiledNavigation } from './compilednavigation';
import * as plugins from './navigation.plugins';
import { NavigationEntry } from './navigationentry';
export class NavigationManager {
navigationManagers: NavigationManager[] = [];
navigationEntries: NavigationEntry[] = [];
public compiledNavigationObservable = new plugins.smartrx.rxjs.Subject<CompiledNavigation>();
public addNavigationManager(navManagerArg: NavigationManager) {
this.navigationManagers.push(navManagerArg);
this.compile();
}
public addNavigationEntry(navEntryArg: NavigationEntry) {
this.navigationEntries.push(navEntryArg);
this.compile();
}
public async compile(): Promise<CompiledNavigation> {
const compiledNavigationInstance = CompiledNavigation.fromNavigationManager(this);
this.compiledNavigationObservable.next(compiledNavigationInstance);
return compiledNavigationInstance;
}
}