MCPcopy
hub / github.com/angular/angular / withDebugTracing

Function withDebugTracing

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

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…