diff --git a/impl/observable.d.ts b/impl/observable.d.ts index 5d74042..f67737e 100644 --- a/impl/observable.d.ts +++ b/impl/observable.d.ts @@ -54,10 +54,6 @@ export declare class Observable { handleError: (error: unknown) => ConvertableToObservable, ): Observable; finally(onFinalize: () => void): Observable; - switchMap( - project: (value: T, index: number) => ConvertableToObservable, - ): Observable; - do(fnOrObserver: ((value: T) => void) | Partial>): Observable; [Symbol.asyncIterator](): AsyncGenerator; } @@ -71,7 +67,6 @@ declare class Subscriber implements Observer { error(error: any): void; complete(): void; addTeardown(teardown: () => void): void; - removeTeardown(teardown: () => void): void; } export {}; diff --git a/impl/observable.js b/impl/observable.js index a917b0b..05c60eb 100644 --- a/impl/observable.js +++ b/impl/observable.js @@ -467,87 +467,6 @@ export class Observable { }); }); } - switchMap(project) { - return new Observable((destination) => { - let index = 0; - let outerComplete = false; - let innerAC; - this.subscribe( - { - next: (value) => { - innerAC?.abort(); - innerAC = new AbortController(); - const signal = abortSignalAny([innerAC.signal, destination.signal]); - let innerObservable; - try { - innerObservable = Observable.from(project(value, index++)); - } catch (error) { - destination.error(error); - return; - } - innerObservable.subscribe( - { - next(innerValue) { - destination.next(innerValue); - }, - error(error) { - destination.error(error); - }, - complete() { - innerAC = undefined; - if (outerComplete) { - destination.complete(); - } - }, - }, - { - signal, - }, - ); - }, - error(error) { - destination.error(error); - }, - complete() { - outerComplete = true; - if (!innerAC) { - destination.complete(); - } - }, - }, - { - signal: destination.signal, - }, - ); - }); - } - do(fnOrObserver) { - return new Observable((destination) => { - const doObserver = - typeof fnOrObserver === 'function' - ? { next: fnOrObserver } - : fnOrObserver; - this.subscribe( - { - next(value) { - doObserver.next?.(value); - destination.next(value); - }, - error(error) { - doObserver.error?.(error); - destination.error(error); - }, - complete() { - doObserver.complete?.(); - destination.complete(); - }, - }, - { - signal: destination.signal, - }, - ); - }); - } [Symbol.asyncIterator]() { let ac; let deferred = []; @@ -701,21 +620,6 @@ class Subscriber { teardown(); } } - removeTeardown(teardown) { - if (this.#teardowns) { - const index = this.#teardowns.indexOf(teardown); - if (index >= 0) { - this.#teardowns.splice(index, 1); - if (this.#teardowns.length === 0) { - this.#teardowns = undefined; - this.#abortController.signal.removeEventListener( - 'abort', - this.#teardownHandler, - ); - } - } - } - } } function noop() {}