From 234442e94825cd8a1d12123bd2d093bec4a3ca09 Mon Sep 17 00:00:00 2001 From: Dzmitry Shylovich Date: Thu, 16 Mar 2017 02:13:57 +0300 Subject: [PATCH] fix(symbol/rxSubscriber): will be exported as rxSubscriber to better support Babel UMD and others To migrate the code follow the example bellow: Before: import { $$rxSubscriber } from 'rxjs/symbol/rxSubscriber'; After: import { rxSubscriber } from 'rxjs/symbol/rxSubscriber'; --- src/Rx.ts | 2 +- src/Subject.ts | 4 ++-- src/Subscriber.ts | 4 ++-- src/symbol/rxSubscriber.ts | 7 ++++++- src/util/toSubscriber.ts | 6 +++--- 5 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Rx.ts b/src/Rx.ts index 58aaa7be5f..3bebef958c 100644 --- a/src/Rx.ts +++ b/src/Rx.ts @@ -169,7 +169,7 @@ import { AsapScheduler } from './scheduler/AsapScheduler'; import { AsyncScheduler } from './scheduler/AsyncScheduler'; import { QueueScheduler } from './scheduler/QueueScheduler'; import { AnimationFrameScheduler } from './scheduler/AnimationFrameScheduler'; -import { $$rxSubscriber as rxSubscriber } from './symbol/rxSubscriber'; +import { rxSubscriber } from './symbol/rxSubscriber'; import { iterator } from './symbol/iterator'; import { observable } from './symbol/observable'; diff --git a/src/Subject.ts b/src/Subject.ts index 8dae4c86d5..b3229f9050 100644 --- a/src/Subject.ts +++ b/src/Subject.ts @@ -5,7 +5,7 @@ import { Subscriber } from './Subscriber'; import { ISubscription, Subscription, TeardownLogic } from './Subscription'; import { ObjectUnsubscribedError } from './util/ObjectUnsubscribedError'; import { SubjectSubscription } from './SubjectSubscription'; -import { $$rxSubscriber } from './symbol/rxSubscriber'; +import { rxSubscriber as rxSubscriberSymbol } from './symbol/rxSubscriber'; /** * @class SubjectSubscriber @@ -21,7 +21,7 @@ export class SubjectSubscriber extends Subscriber { */ export class Subject extends Observable implements ISubscription { - [$$rxSubscriber]() { + [rxSubscriberSymbol]() { return new SubjectSubscriber(this); } diff --git a/src/Subscriber.ts b/src/Subscriber.ts index 8ef868f24f..bcbd38b458 100644 --- a/src/Subscriber.ts +++ b/src/Subscriber.ts @@ -2,7 +2,7 @@ import { isFunction } from './util/isFunction'; import { Observer, PartialObserver } from './Observer'; import { Subscription } from './Subscription'; import { empty as emptyObserver } from './Observer'; -import { $$rxSubscriber } from './symbol/rxSubscriber'; +import { rxSubscriber as rxSubscriberSymbol } from './symbol/rxSubscriber'; /** * Implements the {@link Observer} interface and extends the @@ -16,7 +16,7 @@ import { $$rxSubscriber } from './symbol/rxSubscriber'; */ export class Subscriber extends Subscription implements Observer { - [$$rxSubscriber]() { return this; } + [rxSubscriberSymbol]() { return this; } /** * A static factory for a Subscriber, given a (potentially partial) definition diff --git a/src/symbol/rxSubscriber.ts b/src/symbol/rxSubscriber.ts index fc7630842d..693d0a9881 100644 --- a/src/symbol/rxSubscriber.ts +++ b/src/symbol/rxSubscriber.ts @@ -2,5 +2,10 @@ import { root } from '../util/root'; const Symbol: any = root.Symbol; -export const $$rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ? +export const rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ? Symbol.for('rxSubscriber') : '@@rxSubscriber'; + +/** + * @deprecated use rxSubscriber instead + */ +export const $$rxSubscriber = rxSubscriber; diff --git a/src/util/toSubscriber.ts b/src/util/toSubscriber.ts index 53c73f4781..134fa56b17 100644 --- a/src/util/toSubscriber.ts +++ b/src/util/toSubscriber.ts @@ -1,5 +1,5 @@ import { Subscriber } from '../Subscriber'; -import { $$rxSubscriber } from '../symbol/rxSubscriber'; +import { rxSubscriber as rxSubscriberSymbol } from '../symbol/rxSubscriber'; import { PartialObserver, empty as emptyObserver } from '../Observer'; export function toSubscriber( @@ -12,8 +12,8 @@ export function toSubscriber( return (> nextOrObserver); } - if (nextOrObserver[$$rxSubscriber]) { - return nextOrObserver[$$rxSubscriber](); + if (nextOrObserver[rxSubscriberSymbol]) { + return nextOrObserver[rxSubscriberSymbol](); } }