本文整理汇总了TypeScript中angular2/src/facade/async.PromiseWrapper.isPromise方法的典型用法代码示例。如果您正苦于以下问题:TypeScript PromiseWrapper.isPromise方法的具体用法?TypeScript PromiseWrapper.isPromise怎么用?TypeScript PromiseWrapper.isPromise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/facade/async.PromiseWrapper
的用法示例。
在下文中一共展示了PromiseWrapper.isPromise方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _processStyleElement
_processStyleElement(current) {
current.ignoreBindings = true;
var stylePromise = this._shadowDomStrategy.processStyleElement(this._template.componentId, this._template.absUrl, current.element);
if (isPresent(stylePromise) && PromiseWrapper.isPromise(stylePromise)) {
ListWrapper.push(this._subTaskPromises, stylePromise);
}
}
示例2:
promise = PromiseWrapper.then(this._xhr.get(url), (css) => {
css = this._inlineImports(css, url, inlinedUrls);
if (PromiseWrapper.isPromise(css)) {
return css.then((css) => {
return prefix + this._transformImportedCss(css, mediaQuery, url) + '\n';
});
} else {
return prefix + this._transformImportedCss(css, mediaQuery, url) + '\n';
}
}, (error) => `/* failed to import ${url} */\n`);
示例3: _processStyleElement
_processStyleElement(current: CompileElement, control: CompileControl) {
var stylePromise = this._shadowDomStrategy.processStyleElement(
this._template.componentId, this._template.absUrl, current.element);
if (isPresent(stylePromise) && PromiseWrapper.isPromise(stylePromise)) {
ListWrapper.push(this._subTaskPromises, stylePromise);
}
// Style elements should not be further processed by the compiler, as they can not contain
// bindings. Skipping further compiler steps allow speeding up the compilation process.
control.ignoreCurrentElement();
}
示例4:
(css) => {
// resolve nested @import rules
css = this._inlineImports(css, url, inlinedUrls);
if (PromiseWrapper.isPromise(css)) {
// wait until nested @import are inlined
return css.then((css) => {
return prefix + this._transformImportedCss(css, mediaQuery, url) + '\n'
}) ;
} else {
// there are no nested @import, return the css
return prefix + this._transformImportedCss(css, mediaQuery, url) + '\n';
}
},
示例5: if
ListWrapper.map(protoView.elementBinders, (elementBinder) => {
var nestedComponent = elementBinder.componentDirective;
if (isPresent(nestedComponent) && !(nestedComponent.annotation instanceof DynamicComponent)) {
var nestedCall = this._compile(nestedComponent);
if (PromiseWrapper.isPromise(nestedCall)) {
ListWrapper.push(nestedPVPromises, nestedCall.then((nestedPv) => {
elementBinder.nestedProtoView = nestedPv;
}));
} else {
elementBinder.nestedProtoView = nestedCall;
}
} else if (isPresent(elementBinder.nestedProtoView)) {
this._compileNestedComponents(elementBinder.nestedProtoView, nestedPVPromises);
}
});
示例6: processStyleElement
processStyleElement(hostComponentId, templateUrl, styleEl) {
var cssText = DOM.getText(styleEl);
cssText = this.styleUrlResolver.resolveUrls(cssText, templateUrl);
var css = this.styleInliner.inlineImports(cssText, templateUrl);
if (PromiseWrapper.isPromise(css)) {
DOM.setText(styleEl, '');
return css.then((css) => {
css = shimCssForComponent(css, hostComponentId);
DOM.setText(styleEl, css);
});
} else {
css = shimCssForComponent(css, hostComponentId);
DOM.setText(styleEl, css);
}
DOM.remove(styleEl);
insertStyleElement(this.styleHost, styleEl);
return null;
}
示例7: supports
supports(promise): boolean { return PromiseWrapper.isPromise(promise); }
示例8: compile
compile(component) {
var protoView = this._compile(this._bindDirective(component));
return PromiseWrapper.isPromise(protoView) ? protoView : PromiseWrapper.resolve(protoView);
}