refactor: use isObservable provided by rxjs 6.1+ (#27668)

Refactor common, core, forms, router to use the isObservable method from rxjs 6.1+. Remove the isObservable method from core.

PR Close #27668
This commit is contained in:
Christopher Dahm
2018-12-14 12:19:26 -05:00
committed by Miško Hevery
parent 9e5065a778
commit 7e6350ce2e
13 changed files with 22 additions and 50 deletions

View File

@ -30,7 +30,7 @@ export {global as ɵglobal} from './util/global';
export {looseIdentical as ɵlooseIdentical,} from './util/comparison';
export {stringify as ɵstringify} from './util/stringify';
export {makeDecorator as ɵmakeDecorator} from './util/decorators';
export {isObservable as ɵisObservable, isPromise as ɵisPromise} from './util/lang';
export {isPromise as ɵisPromise} from './util/lang';
export {clearOverrides as ɵclearOverrides, initServicesIfNeeded as ɵinitServicesIfNeeded, overrideComponentView as ɵoverrideComponentView, overrideProvider as ɵoverrideProvider} from './view/index';
export {NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR as ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR} from './view/provider';
export {LocaleDataIndex as ɵLocaleDataIndex, CurrencyIndex as ɵCurrencyIndex, ExtraLocaleDataIndex as ɵExtraLocaleDataIndex, getLocalePluralCase as ɵgetLocalePluralCase, findLocaleData as ɵfindLocaleData, registerLocaleData as ɵregisterLocaleData, unregisterAllLocaleData as ɵunregisterLocaleData} from './i18n/locale_data_api';

View File

@ -6,9 +6,8 @@
* found in the LICENSE file at https://angular.io/license
*/
import {isObservable} from 'rxjs';
import {assertDataInRange} from '../../util/assert';
import {isObservable} from '../../util/lang';
import {EMPTY_OBJ} from '../empty';
import {PropertyAliasValue, TNode, TNodeFlags, TNodeType} from '../interfaces/node';
import {GlobalTargetResolver, RElement, Renderer3, isProceduralRenderer} from '../interfaces/renderer';

View File

@ -15,6 +15,5 @@ ts_library(
deps = [
"//packages:types",
"//packages/core/src/interface",
"@npm//rxjs",
],
)

View File

@ -6,8 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/
import {Observable} from 'rxjs';
/**
* Determine if the argument is shaped like a Promise
*/
@ -16,12 +14,3 @@ export function isPromise(obj: any): obj is Promise<any> {
// It's up to the caller to ensure that obj.then conforms to the spec
return !!obj && typeof obj.then === 'function';
}
/**
* Determine if the argument is an Observable
*/
export function isObservable(obj: any | Observable<any>): obj is Observable<any> {
// TODO: use isObservable once we update pass rxjs 6.1
// https://github.com/ReactiveX/rxjs/blob/master/CHANGELOG.md#610-2018-05-03
return !!obj && typeof obj.subscribe === 'function';
}

View File

@ -6,13 +6,13 @@
* found in the LICENSE file at https://angular.io/license
*/
import {isObservable} from 'rxjs';
import {ChangeDetectorRef, SimpleChange, SimpleChanges, WrappedValue} from '../change_detection/change_detection';
import {INJECTOR, Injector, resolveForwardRef} from '../di';
import {ElementRef} from '../linker/element_ref';
import {TemplateRef} from '../linker/template_ref';
import {ViewContainerRef} from '../linker/view_container_ref';
import {Renderer2} from '../render/api';
import {isObservable} from '../util/lang';
import {stringify} from '../util/stringify';
import {createChangeDetectorRef, createInjector} from './refs';