本文整理汇总了TypeScript中angular2/src/render/dom/direct_dom_renderer.DirectDomRenderer类的典型用法代码示例。如果您正苦于以下问题:TypeScript DirectDomRenderer类的具体用法?TypeScript DirectDomRenderer怎么用?TypeScript DirectDomRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DirectDomRenderer类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor({urlData,
viewCacheCapacity,
shadowDomStrategy,
templates}) {
this._templates = MapWrapper.create();
if (isPresent(templates)) {
ListWrapper.forEach(templates, (template) => {
MapWrapper.set(this._templates, template.componentId, template);
});
}
this._compileCache = MapWrapper.create();
var parser = new Parser(new Lexer());
var urlResolver = new UrlResolver();
if (isBlank(shadowDomStrategy)) {
shadowDomStrategy = new EmulatedUnscopedShadowDomStrategy(new StyleUrlResolver(urlResolver), null);
}
var compiler = new Compiler(new DefaultStepFactory(parser, shadowDomStrategy), new FakeTemplateLoader(urlResolver, urlData));
if (isBlank(viewCacheCapacity)) {
viewCacheCapacity = 1;
}
if (isBlank(urlData)) {
urlData = MapWrapper.create();
}
this.eventPlugin = new FakeEventManagerPlugin();
var eventManager = new EventManager([this.eventPlugin], new FakeVmTurnZone());
var viewFactory = new ViewFactory(viewCacheCapacity, eventManager, shadowDomStrategy);
this.renderer = new DirectDomRenderer(compiler, viewFactory, shadowDomStrategy);
this.rootEl = el('<div></div>');
this.rootProtoViewRef = this.renderer.createRootProtoView(this.rootEl);
}
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:30,代码来源:integration_testbed.ts
示例2: BaseException
_compileRecurse(template) {
var result = MapWrapper.get(this._compileCache, template.componentId);
if (isPresent(result)) {
return result;
}
result = this.renderer.compile(template).then((pv) => {
var childComponentPromises = ListWrapper.map(this._findNestedComponentIds(template, pv), (componentId) => {
var childTemplate = MapWrapper.get(this._templates, componentId);
if (isBlank(childTemplate)) {
throw new BaseException(`Could not find template for ${componentId}!`);
}
return this._compileRecurse(childTemplate);
});
return PromiseWrapper.all(childComponentPromises).then((protoViewRefsWithChildren) => {
var protoViewRefs = ListWrapper.map(protoViewRefsWithChildren, (arr) => arr[0]);
return this._flattenList([this.renderer.mergeChildComponentProtoViews(pv.render, protoViewRefs), protoViewRefsWithChildren]);
});
});
MapWrapper.set(this._compileCache, template.componentId, result);
return result;
}
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:21,代码来源:integration_testbed.ts
示例3:
return PromiseWrapper.all(childComponentPromises).then((protoViewRefsWithChildren) => {
var protoViewRefs = ListWrapper.map(protoViewRefsWithChildren, (arr) => arr[0]);
return this._flattenList([this.renderer.mergeChildComponentProtoViews(pv.render, protoViewRefs), protoViewRefsWithChildren]);
});
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:4,代码来源:integration_testbed.ts
注:本文中的angular2/src/render/dom/direct_dom_renderer.DirectDomRenderer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论