• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript reflection.reflector类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中angular2/src/core/reflection/reflection.reflector的典型用法代码示例。如果您正苦于以下问题:TypeScript reflector类的具体用法?TypeScript reflector怎么用?TypeScript reflector使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了reflector类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: _dependenciesFor

function _dependenciesFor(typeOrFunc: any): ReflectiveDependency[] {
  var params = reflector.parameters(typeOrFunc);
  if (isBlank(params)) return [];
  if (params.some(isBlank)) {
    throw new NoAnnotationError(typeOrFunc, params);
  }
  return params.map((p: any[]) => _extractToken(typeOrFunc, p, params));
}
开发者ID:844496869,项目名称:angular,代码行数:8,代码来源:reflective_provider.ts


示例2: _readMetadata

function _readMetadata(componentType: Type) {
  let metadata = reflector.annotations(componentType).filter(f => f instanceof RoutesMetadata);
  if (metadata.length === 0) {
    throw new BaseException(
        `Component '${stringify(componentType)}' does not have route configuration`);
  }
  return metadata[0];
}
开发者ID:AwelEshetu,项目名称:angular,代码行数:8,代码来源:recognize.ts


示例3: resolveComponent

  resolveComponent(componentType: Type): Promise<ComponentFactory> {
    var metadatas = reflector.annotations(componentType);
    var componentFactory = metadatas.find(_isComponentFactory);

    if (isBlank(componentFactory)) {
      throw new BaseException(`No precompiled component ${stringify(componentType)} found`);
    }
    return PromiseWrapper.resolve(componentFactory);
  }
开发者ID:844496869,项目名称:angular,代码行数:9,代码来源:component_resolver.ts


示例4: compileInHost

  compileInHost(componentType: Type): Promise<HostViewFactoryRef_> {
    var metadatas = reflector.annotations(componentType);
    var hostViewFactory = metadatas.find(isHostViewFactory);

    if (isBlank(hostViewFactory)) {
      throw new BaseException(`No precompiled component ${stringify(componentType)} found`);
    }
    return PromiseWrapper.resolve(new HostViewFactoryRef_(hostViewFactory));
  }
开发者ID:0oAimZo0,项目名称:Angular2Learning,代码行数:9,代码来源:compiler.ts


示例5: resolve

 /**
  * Return {@link PipeMetadata} for a given `Type`.
  */
 resolve(type: Type): PipeMetadata {
   var metas = reflector.annotations(resolveForwardRef(type));
   if (isPresent(metas)) {
     var annotation = metas.find(_isPipeMetadata);
     if (isPresent(annotation)) {
       return annotation;
     }
   }
   throw new BaseException(`No Pipe decorator found on ${stringify(type)}`);
 }
开发者ID:0oAimZo0,项目名称:Angular2Learning,代码行数:13,代码来源:pipe_resolver.ts


示例6: resolve

 /**
  * Return {@link PipeMetadata} for a given `Type`.
  */
 resolve(type: Type): PipeMetadata {
   var metas = reflector.annotations(resolveForwardRef(type));
   if (isPresent(metas)) {
     for (var i = 0; i < metas.length; i++) {
       var annotation = metas[i];
       if (annotation instanceof PipeMetadata) {
         return annotation;
       }
     }
   }
   throw new BaseException(`No Pipe decorator found on ${stringify(type)}`);
 }
开发者ID:beta3000,项目名称:hola-angular2,代码行数:15,代码来源:pipe_resolver.ts


示例7: resolveReflectiveFactory

export function resolveReflectiveFactory(provider: Provider): ResolvedReflectiveFactory {
  var factoryFn: Function;
  var resolvedDeps;
  if (isPresent(provider.useClass)) {
    var useClass = resolveForwardRef(provider.useClass);
    factoryFn = reflector.factory(useClass);
    resolvedDeps = _dependenciesFor(useClass);
  } else if (isPresent(provider.useExisting)) {
    factoryFn = (aliasInstance) => aliasInstance;
    resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
  } else if (isPresent(provider.useFactory)) {
    factoryFn = provider.useFactory;
    resolvedDeps = constructDependencies(provider.useFactory, provider.dependencies);
  } else {
    factoryFn = () => provider.useValue;
    resolvedDeps = _EMPTY_LIST;
  }
  return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
}
开发者ID:844496869,项目名称:angular,代码行数:19,代码来源:reflective_provider.ts


示例8: beforeEach

 beforeEach(inject([Compiler], (_compiler) => {
   someHostViewFactory = new HostViewFactory(null, null);
   reflector.registerType(SomeComponent, new ReflectionInfo([someHostViewFactory]));
 }));
开发者ID:Ashok-Pal,项目名称:angular,代码行数:4,代码来源:compiler_spec.ts


示例9: beforeEach

 beforeEach(inject([Compiler], (_compiler) => {
   compiler = _compiler;
   cht = new CompiledHostTemplate(new CompiledComponentTemplate('aCompId', null, null, null));
   reflector.registerType(SomeComponent, new ReflectionInfo([cht]));
 }));
开发者ID:TedSander,项目名称:angular,代码行数:5,代码来源:compiler_spec.ts



注:本文中的angular2/src/core/reflection/reflection.reflector类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript api.RenderCommandVisitor类代码示例发布时间:2022-05-25
下一篇:
TypeScript wtf_init.wtfInit函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap