Skip to content

Commit

Permalink
Remove methods that we haven't agreed on yet
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh committed Dec 19, 2023
1 parent 2171e3f commit 2a0474c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 101 deletions.
5 changes: 0 additions & 5 deletions impl/observable.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ export declare class Observable<T> {
handleError: (error: unknown) => ConvertableToObservable<R>,
): Observable<T | R>;
finally(onFinalize: () => void): Observable<T>;
switchMap<R>(
project: (value: T, index: number) => ConvertableToObservable<R>,
): Observable<R>;
do(fnOrObserver: ((value: T) => void) | Partial<Observer<T>>): Observable<T>;
[Symbol.asyncIterator](): AsyncGenerator<T>;
}

Expand All @@ -71,7 +67,6 @@ declare class Subscriber<T> implements Observer<T> {
error(error: any): void;
complete(): void;
addTeardown(teardown: () => void): void;
removeTeardown(teardown: () => void): void;
}

export {};
96 changes: 0 additions & 96 deletions impl/observable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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() {}

Expand Down

0 comments on commit 2a0474c

Please sign in to comment.