Skip to content

Commit

Permalink
fix(Subject): fix missing unsubscribe call
Browse files Browse the repository at this point in the history
Fix a bug manifested when running the test
'Observable.prototype.bufferWhen should emit buffers using varying hot
closings'. These changes are important to make unsubscriptions appear
for that test.

Relates to #381.
  • Loading branch information
Andre Medeiros authored and benlesh committed Oct 14, 2015
1 parent 50e9163 commit 9dd27d6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/subjects/SubjectSubscription.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Subject from '../Subject';
import Subscription from '../Subscription';
import Observer from '../Observer';
import Subscriber from '../Subscriber';

export default class SubjectSubscription<T> extends Subscription<T> {
isUnsubscribed: boolean = false;
Expand All @@ -25,6 +26,9 @@ export default class SubjectSubscription<T> extends Subscription<T> {
return;
}

if (this.observer instanceof Subscriber) {
(<Subscriber<T>> this.observer).unsubscribe();
}
const subscriberIndex = observers.indexOf(this.observer);

if (subscriberIndex !== -1) {
Expand Down

0 comments on commit 9dd27d6

Please sign in to comment.