mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-12 05:31:41 +00:00
update
This commit is contained in:
44
node_modules/rxjs/_esm2015/AsyncSubject.js
generated
vendored
Normal file
44
node_modules/rxjs/_esm2015/AsyncSubject.js
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
import { Subject } from './Subject';
|
||||
import { Subscription } from './Subscription';
|
||||
/**
|
||||
* @class AsyncSubject<T>
|
||||
*/
|
||||
export class AsyncSubject extends Subject {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
this.value = null;
|
||||
this.hasNext = false;
|
||||
this.hasCompleted = false;
|
||||
}
|
||||
/** @deprecated internal use only */ _subscribe(subscriber) {
|
||||
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) {
|
||||
if (!this.hasCompleted) {
|
||||
this.value = value;
|
||||
this.hasNext = true;
|
||||
}
|
||||
}
|
||||
error(error) {
|
||||
if (!this.hasCompleted) {
|
||||
super.error(error);
|
||||
}
|
||||
}
|
||||
complete() {
|
||||
this.hasCompleted = true;
|
||||
if (this.hasNext) {
|
||||
super.next(this.value);
|
||||
}
|
||||
super.complete();
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=AsyncSubject.js.map
|
Reference in New Issue
Block a user