Skip to content

Commit

Permalink
feat(Subscriber): add rxSubscriber symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
benlesh committed Dec 8, 2015
1 parent d2e4257 commit 7bda360
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/subscriber-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* globals describe, it, expect */
var Rx = require('../dist/cjs/Rx');
var Subscriber = Rx.Subscriber;

describe('Subscriber', function () {
it('should have the rxSubscriber symbol', function () {
var sub = new Subscriber();
expect(sub[Rx.Symbol.rxSubscriber]()).toBe(sub);
});
});
5 changes: 5 additions & 0 deletions src/Subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,16 @@ import {tryOrOnError} from './util/tryOrOnError';

import {Observer} from './Observer';
import {Subscription} from './Subscription';
import {rxSubscriber} from './symbol/rxSubscriber';

export class Subscriber<T> extends Subscription<T> implements Observer<T> {
protected _subscription: Subscription<T>;
protected _isUnsubscribed: boolean = false;

[rxSubscriber]() {
return this;
}

get isUnsubscribed(): boolean {
const subscription = this._subscription;
if (subscription) {
Expand Down

0 comments on commit 7bda360

Please sign in to comment.