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

Function withDebugTracing

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

Source from the content-addressed store, hash-verified

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