MCPcopy
hub / github.com/angular/angularfire / traceWhile

Function traceWhile

src/compat/performance/performance.ts:90–113  ·  view source on GitHub ↗
(
  name: string,
  test: (a: T) => boolean,
  options?: { orComplete?: boolean }
)

Source from the content-addressed store, hash-verified

88});
89
90export const traceWhile = <T = any>(
91 name: string,
92 test: (a: T) => boolean,
93 options?: { orComplete?: boolean }
94) => (source$: Observable<T>) => new Observable<T>(subscriber => {
95 let traceSubscription: Subscription | undefined;
96 return source$.pipe(
97 tap(
98 a => {
99 if (test(a)) {
100 traceSubscription = traceSubscription || trace$(name).subscribe();
101 } else {
102 if (traceSubscription) {
103 traceSubscription.unsubscribe();
104 }
105
106 traceSubscription = undefined;
107 }
108 },
109 () => undefined,
110 () => options && options.orComplete && traceSubscription && traceSubscription.unsubscribe()
111 )
112 ).subscribe(subscriber);
113});
114
115export const traceUntilComplete = <T = any>(name: string) => (source$: Observable<T>) => new Observable<T>(subscriber => {
116 const traceSubscription = trace$(name).subscribe();

Callers

nothing calls this directly

Calls 1

trace$Function · 0.85

Tested by

no test coverage detected