refactor(facade): refactor type check function - is*()
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
||||
import {isPresent} from 'angular2/src/facade/lang';
|
||||
import {isPresent, isArray} from 'angular2/src/facade/lang';
|
||||
import {DirectiveMetadata} from 'angular2/src/render/api';
|
||||
|
||||
/**
|
||||
@ -63,5 +63,5 @@ export function directiveMetadataFromMap(map: Map<string, any>): DirectiveMetada
|
||||
*/
|
||||
function _cloneIfPresent(o): any {
|
||||
if (!isPresent(o)) return null;
|
||||
return ListWrapper.isList(o) ? ListWrapper.clone(o) : MapWrapper.clone(o);
|
||||
return isArray(o) ? ListWrapper.clone(o) : MapWrapper.clone(o);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {isBlank, isPresent} from 'angular2/src/facade/lang';
|
||||
import {isBlank, isPresent, isPromise} from 'angular2/src/facade/lang';
|
||||
import {PromiseWrapper, Promise} from 'angular2/src/facade/async';
|
||||
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
@ -37,7 +37,7 @@ export class EmulatedScopedShadowDomStrategy extends EmulatedUnscopedShadowDomSt
|
||||
cssText = this.styleUrlResolver.resolveUrls(cssText, templateUrl);
|
||||
var inlinedCss = this.styleInliner.inlineImports(cssText, templateUrl);
|
||||
|
||||
if (PromiseWrapper.isPromise(inlinedCss)) {
|
||||
if (isPromise(inlinedCss)) {
|
||||
DOM.setText(styleEl, '');
|
||||
return (<Promise<string>>inlinedCss)
|
||||
.then((css) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {isBlank, isPresent, assertionsEnabled} from 'angular2/src/facade/lang';
|
||||
import {isBlank, isPresent, assertionsEnabled, isPromise} from 'angular2/src/facade/lang';
|
||||
import {MapWrapper, List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
||||
|
||||
@ -30,7 +30,7 @@ export class ShadowDomCompileStep implements CompileStep {
|
||||
_processStyleElement(current: CompileElement, control: CompileControl) {
|
||||
var stylePromise = this._shadowDomStrategy.processStyleElement(
|
||||
this._template.componentId, this._template.templateAbsUrl, current.element);
|
||||
if (isPresent(stylePromise) && PromiseWrapper.isPromise(stylePromise)) {
|
||||
if (isPresent(stylePromise) && isPromise(stylePromise)) {
|
||||
ListWrapper.push(this._subTaskPromises, stylePromise);
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import {
|
||||
RegExpWrapper,
|
||||
StringWrapper,
|
||||
normalizeBlank,
|
||||
isPromise
|
||||
} from 'angular2/src/facade/lang';
|
||||
import {
|
||||
Promise,
|
||||
@ -76,7 +77,7 @@ export class StyleInliner {
|
||||
promise = PromiseWrapper.then(this._xhr.get(url), (rawCss) => {
|
||||
// resolve nested @import rules
|
||||
var inlinedCss = this._inlineImports(rawCss, url, inlinedUrls);
|
||||
if (PromiseWrapper.isPromise(inlinedCss)) {
|
||||
if (isPromise(inlinedCss)) {
|
||||
// wait until nested @import are inlined
|
||||
return (<Promise<string>>inlinedCss)
|
||||
.then((css) => {return prefix + this._transformImportedCss(css, mediaQuery, url) +
|
||||
|
Reference in New Issue
Block a user