diff --git a/src/Observable.ts b/src/Observable.ts index 0aa4b4cef39..e231ed93090 100644 --- a/src/Observable.ts +++ b/src/Observable.ts @@ -6,7 +6,7 @@ import { root } from './util/root'; import { toSubscriber } from './util/toSubscriber'; import { IfObservable } from './observable/IfObservable'; import { ErrorObservable } from './observable/ErrorObservable'; -import { $$observable } from './symbol/observable'; +import { observable as Symbol_observable } from './symbol/observable'; export interface Subscribable { subscribe(observerOrNext?: PartialObserver | ((value: T) => void), @@ -177,7 +177,7 @@ export class Observable implements Subscribable { * @method Symbol.observable * @return {Observable} this instance of the observable */ - [$$observable]() { + [Symbol_observable]() { return this; } } diff --git a/src/Rx.ts b/src/Rx.ts index b04c99c505c..a098c81eef9 100644 --- a/src/Rx.ts +++ b/src/Rx.ts @@ -171,7 +171,7 @@ import { QueueScheduler } from './scheduler/QueueScheduler'; import { AnimationFrameScheduler } from './scheduler/AnimationFrameScheduler'; import { $$rxSubscriber as rxSubscriber } from './symbol/rxSubscriber'; import { $$iterator as iterator } from './symbol/iterator'; -import { $$observable as observable } from './symbol/observable'; +import { observable } from './symbol/observable'; /* tslint:enable:no-unused-variable */ diff --git a/src/observable/FromObservable.ts b/src/observable/FromObservable.ts index 5e9bf489531..384e562eb8e 100644 --- a/src/observable/FromObservable.ts +++ b/src/observable/FromObservable.ts @@ -11,7 +11,7 @@ import { $$iterator } from '../symbol/iterator'; import { Observable, ObservableInput } from '../Observable'; import { Subscriber } from '../Subscriber'; import { ObserveOnSubscriber } from '../operator/observeOn'; -import { $$observable } from '../symbol/observable'; +import { observable as Symbol_observable } from '../symbol/observable'; /** * We need this JSDoc comment for affecting ESDoc. @@ -84,7 +84,7 @@ export class FromObservable extends Observable { */ static create(ish: ObservableInput, scheduler?: IScheduler): Observable { if (ish != null) { - if (typeof ish[$$observable] === 'function') { + if (typeof ish[Symbol_observable] === 'function') { if (ish instanceof Observable && !scheduler) { return ish; } @@ -107,9 +107,9 @@ export class FromObservable extends Observable { const ish = this.ish; const scheduler = this.scheduler; if (scheduler == null) { - return ish[$$observable]().subscribe(subscriber); + return ish[Symbol_observable]().subscribe(subscriber); } else { - return ish[$$observable]().subscribe(new ObserveOnSubscriber(subscriber, scheduler, 0)); + return ish[Symbol_observable]().subscribe(new ObserveOnSubscriber(subscriber, scheduler, 0)); } } } diff --git a/src/symbol/observable.ts b/src/symbol/observable.ts index 19809d50b4e..06c2bfb5568 100644 --- a/src/symbol/observable.ts +++ b/src/symbol/observable.ts @@ -18,4 +18,9 @@ export function getSymbolObservable(context: any) { return $$observable; } -export const $$observable = getSymbolObservable(root); \ No newline at end of file +export const observable = getSymbolObservable(root); + +/** + * @deprecated use observable instead + */ +export const $$observable = observable; diff --git a/src/util/subscribeToResult.ts b/src/util/subscribeToResult.ts index 29af49afa5d..4a563f399b6 100644 --- a/src/util/subscribeToResult.ts +++ b/src/util/subscribeToResult.ts @@ -8,7 +8,7 @@ import { $$iterator } from '../symbol/iterator'; import { Subscription } from '../Subscription'; import { InnerSubscriber } from '../InnerSubscriber'; import { OuterSubscriber } from '../OuterSubscriber'; -import { $$observable } from '../symbol/observable'; +import { observable as Symbol_observable } from '../symbol/observable'; export function subscribeToResult(outerSubscriber: OuterSubscriber, result: any, @@ -67,8 +67,8 @@ export function subscribeToResult(outerSubscriber: OuterSubscriber, break; } } while (true); - } else if (result && typeof result[$$observable] === 'function') { - const obs = result[$$observable](); + } else if (result && typeof result[Symbol_observable] === 'function') { + const obs = result[Symbol_observable](); if (typeof obs.subscribe !== 'function') { destination.error(new TypeError('Provided object does not correctly implement Symbol.observable')); } else {