refactor(facade): move isPromise to core private (#10573)
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {isPromise} from '../src/facade/lang';
|
||||
import {isPromise} from '../src/util/lang';
|
||||
|
||||
import {Inject, Injectable, OpaqueToken, Optional} from './di';
|
||||
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
import {ErrorHandler} from '../src/error_handler';
|
||||
import {ListWrapper} from '../src/facade/collection';
|
||||
import {unimplemented} from '../src/facade/errors';
|
||||
import {isBlank, isPresent, isPromise, stringify} from '../src/facade/lang';
|
||||
import {isBlank, isPresent, stringify} from '../src/facade/lang';
|
||||
import {isPromise} from '../src/util/lang';
|
||||
|
||||
import {ApplicationInitStatus} from './application_init';
|
||||
import {APP_BOOTSTRAP_LISTENER, PLATFORM_INITIALIZER} from './application_tokens';
|
||||
|
||||
@@ -39,6 +39,7 @@ import * as reflector_reader from './reflection/reflector_reader';
|
||||
import * as reflection_types from './reflection/types';
|
||||
import * as api from './render/api';
|
||||
import * as decorators from './util/decorators';
|
||||
import {isPromise} from './util/lang';
|
||||
|
||||
export var __core_private__: {
|
||||
isDefaultChangeDetectionStrategy: typeof constants.isDefaultChangeDetectionStrategy,
|
||||
@@ -118,9 +119,11 @@ export var __core_private__: {
|
||||
ANY_STATE: typeof ANY_STATE_,
|
||||
DEFAULT_STATE: typeof DEFAULT_STATE_,
|
||||
EMPTY_STATE: typeof EMPTY_STATE_,
|
||||
FILL_STYLE_FLAG: typeof FILL_STYLE_FLAG_, _ComponentStillLoadingError?: ComponentStillLoadingError
|
||||
ComponentStillLoadingError: typeof ComponentStillLoadingError
|
||||
} = {
|
||||
FILL_STYLE_FLAG: typeof FILL_STYLE_FLAG_,
|
||||
_ComponentStillLoadingError?: ComponentStillLoadingError,
|
||||
ComponentStillLoadingError: typeof ComponentStillLoadingError,
|
||||
isPromise: typeof isPromise
|
||||
} = {
|
||||
isDefaultChangeDetectionStrategy: constants.isDefaultChangeDetectionStrategy,
|
||||
ChangeDetectorStatus: constants.ChangeDetectorStatus,
|
||||
CHANGE_DETECTION_STRATEGY_VALUES: constants.CHANGE_DETECTION_STRATEGY_VALUES,
|
||||
@@ -185,5 +188,6 @@ export var __core_private__: {
|
||||
DEFAULT_STATE: DEFAULT_STATE_,
|
||||
EMPTY_STATE: EMPTY_STATE_,
|
||||
FILL_STYLE_FLAG: FILL_STYLE_FLAG_,
|
||||
ComponentStillLoadingError: ComponentStillLoadingError
|
||||
ComponentStillLoadingError: ComponentStillLoadingError,
|
||||
isPromise: isPromise
|
||||
};
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
export function isPromise(obj: any): obj is Promise<any> {
|
||||
// allow any Promise/A+ compliant thenable.
|
||||
// It's up to the caller to ensure that obj.then conforms to the spec
|
||||
return !!obj && typeof obj.then === 'function';
|
||||
}
|
||||
Reference in New Issue
Block a user