Skip to content

Commit 634a94a

Browse files
committed
Your operators were bad and you should feel bad
1 parent 32d2bf9 commit 634a94a

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/performance/performance.ts

+15-15
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,18 @@ export class AngularFirePerformance {
7373
})
7474
);
7575

76-
traceUntil = <T=any>(name:string, test: (a:T) => boolean, options?: TraceOptions & { orComplete: boolean }) => (source$: Observable<T>) => {
76+
traceUntil = <T=any>(name:string, test: (a:T) => boolean, options?: TraceOptions & { orComplete: boolean }) => (source$: Observable<T>) => new Observable<T>(subscriber => {
7777
const traceSubscription = this.trace$(name, options).subscribe();
7878
return source$.pipe(
7979
tap(
8080
a => test(a) && traceSubscription.unsubscribe(),
8181
() => {},
8282
() => options && options.orComplete && traceSubscription.unsubscribe()
8383
)
84-
)
85-
};
84+
).subscribe(subscriber);
85+
});
8686

87-
traceWhile = <T=any>(name:string, test: (a:T) => boolean, options?: TraceOptions & { orComplete: boolean}) => (source$: Observable<T>) => {
87+
traceWhile = <T=any>(name:string, test: (a:T) => boolean, options?: TraceOptions & { orComplete: boolean}) => (source$: Observable<T>) => new Observable<T>(subscriber => {
8888
let traceSubscription: Subscription|undefined;
8989
return source$.pipe(
9090
tap(
@@ -99,40 +99,40 @@ export class AngularFirePerformance {
9999
() => {},
100100
() => options && options.orComplete && traceSubscription && traceSubscription.unsubscribe()
101101
)
102-
)
103-
};
102+
).subscribe(subscriber);
103+
});
104104

105-
traceUntilComplete = <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => {
105+
traceUntilComplete = <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => new Observable<T>(subscriber => {
106106
const traceSubscription = this.trace$(name, options).subscribe();
107107
return source$.pipe(
108108
tap(
109109
() => {},
110110
() => {},
111111
() => traceSubscription.unsubscribe()
112112
)
113-
)
114-
};
113+
).subscribe(subscriber);
114+
});
115115

116-
traceUntilFirst = <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => {
116+
traceUntilFirst = <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => new Observable<T>(subscriber => {
117117
const traceSubscription = this.trace$(name, options).subscribe();
118118
return source$.pipe(
119119
tap(
120120
() => traceSubscription.unsubscribe(),
121121
() => {},
122122
() => {}
123123
)
124-
)
125-
};
124+
).subscribe(subscriber);
125+
});
126126

127-
trace = <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => {
127+
trace = <T=any>(name:string, options?: TraceOptions) => (source$: Observable<T>) => new Observable<T>(subscriber => {
128128
const traceSubscription = this.trace$(name, options).subscribe();
129129
return source$.pipe(
130130
tap(
131131
() => traceSubscription.unsubscribe(),
132132
() => {},
133133
() => traceSubscription.unsubscribe()
134134
)
135-
)
136-
};
135+
).subscribe(subscriber);
136+
});
137137

138138
}

0 commit comments

Comments
 (0)