@ngworker/router-component-store
Version:
A strictly typed lightweight alternative to NgRx Router Store (@ngrx/router-store) and ActivatedRoute
15 lines (14 loc) • 653 B
TypeScript
import { Type } from '@angular/core';
import { Event as RouterEvent } from '@angular/router';
import { OperatorFunction } from 'rxjs';
/**
* Narrow a stream of router events to the specified router event types.
*
* @param acceptedEventTypes The types of router events to accept.
*
* @example <caption>Usage</caption>
* const navigation$ = router.events.pipe(
* filterRouterEvents(NavigationStart, NavigationEnd),
* );
*/
export declare function filterRouterEvents<TAcceptedRouterEvents extends Type<RouterEvent>[]>(...acceptedEventTypes: [...TAcceptedRouterEvents]): OperatorFunction<RouterEvent, InstanceType<TAcceptedRouterEvents[number]>>;