MCPcopy Create free account
hub / github.com/angular/angular / withDebugTracing

Function withDebugTracing

packages/router/src/provide_router.ts:519–544  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

517 * @publicApi
518 */
519export function withDebugTracing(): DebugTracingFeature {
520 let providers: Provider[] = [];
521 if (typeof ngDevMode === 'undefined' || ngDevMode) {
522 providers = [
523 {
524 provide: ENVIRONMENT_INITIALIZER,
525 multi: true,
526 useFactory: () => {
527 const router = inject(Router);
528 return () =>
529 router.events.subscribe((e: Event) => {
530 // tslint:disable:no-console
531 console.group?.(`Router Event: ${(<any>e.constructor).name}`);
532 console.log(stringifyEvent(e));
533 console.log(e);
534 console.groupEnd?.();
535 // tslint:enable:no-console
536 });
537 },
538 },
539 ];
540 } else {
541 providers = [];
542 }
543 return routerFeature(RouterFeatureKind.DebugTracingFeature, providers);
544}
545
546const ROUTER_PRELOADER = new InjectionToken<RouterPreloader>(
547 typeof ngDevMode === 'undefined' || ngDevMode ? 'router preloader' : '',

Callers 1

forRootMethod · 0.90

Calls 6

injectFunction · 0.90
stringifyEventFunction · 0.90
routerFeatureFunction · 0.85
subscribeMethod · 0.65
logMethod · 0.65
groupMethod · 0.45

Tested by

no test coverage detected