diff options
Diffstat (limited to 'tools/node_modules/eslint/node_modules/rxjs/src/internal/AsyncSubject.ts')
-rw-r--r-- | tools/node_modules/eslint/node_modules/rxjs/src/internal/AsyncSubject.ts | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/tools/node_modules/eslint/node_modules/rxjs/src/internal/AsyncSubject.ts b/tools/node_modules/eslint/node_modules/rxjs/src/internal/AsyncSubject.ts deleted file mode 100644 index 218e8d219f..0000000000 --- a/tools/node_modules/eslint/node_modules/rxjs/src/internal/AsyncSubject.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Subject } from './Subject'; -import { Subscriber } from './Subscriber'; -import { Subscription } from './Subscription'; - -/** - * A variant of Subject that only emits a value when it completes. It will emit - * its latest value to all its observers on completion. - * - * @class AsyncSubject<T> - */ -export class AsyncSubject<T> extends Subject<T> { - private value: T = null; - private hasNext: boolean = false; - private hasCompleted: boolean = false; - - /** @deprecated This is an internal implementation detail, do not use. */ - _subscribe(subscriber: Subscriber<any>): Subscription { - if (this.hasError) { - subscriber.error(this.thrownError); - return Subscription.EMPTY; - } else if (this.hasCompleted && this.hasNext) { - subscriber.next(this.value); - subscriber.complete(); - return Subscription.EMPTY; - } - return super._subscribe(subscriber); - } - - next(value: T): void { - if (!this.hasCompleted) { - this.value = value; - this.hasNext = true; - } - } - - error(error: any): void { - if (!this.hasCompleted) { - super.error(error); - } - } - - complete(): void { - this.hasCompleted = true; - if (this.hasNext) { - super.next(this.value); - } - super.complete(); - } -} |