Skip to content

Commit 7bda360

Browse files
committed
feat(Subscriber): add rxSubscriber symbol
1 parent d2e4257 commit 7bda360

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

spec/subscriber-spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/* globals describe, it, expect */
2+
var Rx = require('../dist/cjs/Rx');
3+
var Subscriber = Rx.Subscriber;
4+
5+
describe('Subscriber', function () {
6+
it('should have the rxSubscriber symbol', function () {
7+
var sub = new Subscriber();
8+
expect(sub[Rx.Symbol.rxSubscriber]()).toBe(sub);
9+
});
10+
});

src/Subscriber.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,16 @@ import {tryOrOnError} from './util/tryOrOnError';
44

55
import {Observer} from './Observer';
66
import {Subscription} from './Subscription';
7+
import {rxSubscriber} from './symbol/rxSubscriber';
78

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

13+
[rxSubscriber]() {
14+
return this;
15+
}
16+
1217
get isUnsubscribed(): boolean {
1318
const subscription = this._subscription;
1419
if (subscription) {

0 commit comments

Comments
 (0)