graycoreio/daffodil

View on GitHub
libs/navigation/driver/src/interfaces/navigation-service.interface.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { Observable } from 'rxjs';

import { createSingletonInjectionToken } from '@daffodil/core';
import { DaffGenericNavigationTree } from '@daffodil/navigation';

export interface DaffNavigationServiceInterface<T extends DaffGenericNavigationTree<T>> {
  /**
   * Requests a specific navigation item by ID.
   */
  get(id: T['id']): Observable<T>;

  /**
   * Requests the entire top-level navigation tree.
   */
  getTree(): Observable<T>;
}

export const {
  token: DaffNavigationDriver,
  /**
   * Provider function for {@link DaffNavigationDriver}.
   */
  provider: provideDaffNavigationDriver,
} = createSingletonInjectionToken<DaffNavigationServiceInterface<any>>('DaffNavigationDriver');