Skip to content

Commit

Permalink
fix(AnonymousSubject): allow anonymous observers as destination
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh committed May 22, 2016
1 parent 55d5141 commit 0e2c28b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Subject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,15 +115,24 @@ export class AnonymousSubject<T> extends Subject<T> {
}

next(value: T) {
this.destination.next(value);
const { destination } = this;
if (destination && destination.next) {
destination.next(value);
}
}

error(err: any) {
this.destination.error(err);
const { destination } = this;
if (destination && destination.error) {
this.destination.error(err);
}
}

complete() {
this.destination.complete();
const { destination } = this;
if (destination && destination.complete) {
this.destination.complete();
}
}

_subscribe(subscriber: Subscriber<T>): Subscription {
Expand Down

0 comments on commit 0e2c28b

Please sign in to comment.