-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
This work is blocked on finishing #5729 reviews and landing it... but the crux of it is simple enough... this pattern exists in all operators:
export function someOperator<A, B>(...args: any[]): OperatorFunction(A, B) {
return (source: Observable<A>) => lift(source, function (this: Subscriber<B>, liftedSource: Observable<A>) {
// Do things here and maybe return teardown.
});
}The idea is to go through and replace the return here with a helper that does this wiring for us:
function operate<A, B>(init: (subscriber: Subscriber<B>, liftedSource: Observable<A>) => TeardownLogic) {
return (source: Observable<A>) => wrappedLift(source, init);
}usage:
export function someOperator<A, B>(...args: any[]): OperatorFunction(A, B) {
return operate((subscriber, liftedSource) => {
// Do things here and maybe return teardown.
});
}Then use it in each operator to further reduce size. It may also help with readability? Either way, comments will be required.
tonivj5tonivj5
Metadata
Metadata
Assignees
Labels
No labels