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

TypeScript lang.assertionsEnabled函数代码示例

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

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



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

示例1: constructor

  constructor(config?: ChangeDetectorGenConfig,
              protoChangeDetectorsForTest?: StringMap<string, Function>) {
    super();
    this._dynamicChangeDetection = new DynamicChangeDetection();
    this._protoChangeDetectorFactories = isPresent(protoChangeDetectorsForTest) ?
                                             protoChangeDetectorsForTest :
                                             preGeneratedProtoDetectors;

    this._genConfig =
        isPresent(config) ? config : new ChangeDetectorGenConfig(assertionsEnabled(),
                                                                 assertionsEnabled(), false);
  }
开发者ID:KenWilliamson,项目名称:Angular2HostedMobileApp,代码行数:12,代码来源:change_detection.ts


示例2: xdescribe

 xdescribe('Missing directive checks', () => {
   if (assertionsEnabled()) {
     function expectCompileError(inlineTpl, errMessage, done) {
       tplResolver.setTemplate(MyComp, new Template({inline: inlineTpl}));
       PromiseWrapper.then(compiler.compile(MyComp), (value) => {
         throw new BaseException("Test failure: should not have come here as an exception was expected");
       }, (err) => {
         expect(err.message).toEqual(errMessage);
         done();
       });
     }
     it('should raise an error if no directive is registered for a template with template bindings', inject([AsyncTestCompleter], (async) => {
       expectCompileError('<div><div template="if: foo"></div></div>', 'Missing directive to handle \'if\' in <div template="if: foo">', () => async.done());
     }));
     it('should raise an error for missing template directive (1)', inject([AsyncTestCompleter], (async) => {
       expectCompileError('<div><template foo></template></div>', 'Missing directive to handle: <template foo>', () => async.done());
     }));
     it('should raise an error for missing template directive (2)', inject([AsyncTestCompleter], (async) => {
       expectCompileError('<div><template *if="condition"></template></div>', 'Missing directive to handle: <template *if="condition">', () => async.done());
     }));
     it('should raise an error for missing template directive (3)', inject([AsyncTestCompleter], (async) => {
       expectCompileError('<div *if="condition"></div>', 'Missing directive to handle \'if\' in MyComp: <div *if="condition">', () => async.done());
     }));
   }
 });
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:25,代码来源:integration_spec.ts


示例3: _genThrowOnChangeCheck

 /** @internal */
 _genThrowOnChangeCheck(oldValue: string, newValue: string): string {
   if (assertionsEnabled()) {
     return `
       if(throwOnChange) {
         this.throwOnChangeError(${oldValue}, ${newValue});
       }
       `;
   } else {
     return '';
   }
 }
开发者ID:Konviser,项目名称:todo-list,代码行数:12,代码来源:change_detection_jit_generator.ts


示例4: _genThrowOnChangeCheck

 /** @internal */
 _genThrowOnChangeCheck(oldValue: string, newValue: string): string {
   if (assertionsEnabled()) {
     return `
       if (throwOnChange && !${this.changeDetectionUtilVarName}.devModeEqual(${oldValue}, ${newValue})) {
         this.throwOnChangeError(${oldValue}, ${newValue});
       }
       `;
   } else {
     return '';
   }
 }
开发者ID:1186792881,项目名称:angular,代码行数:12,代码来源:change_detection_jit_generator.ts


示例5: _createVmZone

function _createVmZone(givenReporter) {
  var defaultErrorReporter = (exception, stackTrace) => {
    var longStackTrace = ListWrapper.join(stackTrace, "\n\n-----async gap-----\n");
    print(`${exception}\n\n${longStackTrace}`);
    throw exception;
  };
  var reporter = isPresent(givenReporter) ? givenReporter : defaultErrorReporter;
  var zone = new VmTurnZone({enableLongStackTrace: assertionsEnabled()});
  zone.initCallbacks({onErrorHandler: reporter});
  return zone;
}
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:11,代码来源:application.ts


示例6: _processContentElement

 _processContentElement(current) {
   if (this._shadowDomStrategy.hasNativeContentElement()) {
     return ;
   }
   var attrs = current.attrs();
   var selector = MapWrapper.get(attrs, 'select');
   selector = isPresent(selector) ? selector : '';
   var contentStart = DOM.createScriptTag('type', 'ng/contentStart');
   if (assertionsEnabled()) {
     DOM.setAttribute(contentStart, 'select', selector);
   }
   var contentEnd = DOM.createScriptTag('type', 'ng/contentEnd');
   DOM.insertBefore(current.element, contentStart);
   DOM.insertBefore(current.element, contentEnd);
   DOM.remove(current.element);
   current.element = contentStart;
   current.bindElement().setContentTagSelector(selector);
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:18,代码来源:shadow_dom_compile_step.ts


示例7: constructor

 constructor(element, compilationUnit = '') {
   this.element = element;
   this._attrs = null;
   this._classList = null;
   this.isViewRoot = false;
   this.inheritedProtoView = null;
   this.inheritedElementBinder = null;
   this.distanceToInheritedBinder = 0;
   this.compileChildren = true;
   this.ignoreBindings = false;
   var tplDesc = assertionsEnabled() ? getElementDescription(element) : null;
   if (compilationUnit !== '') {
     this.elementDescription = compilationUnit;
     if (isPresent(tplDesc))
       this.elementDescription += ": " + tplDesc;
   } else {
     this.elementDescription = tplDesc;
   }
 }
开发者ID:gdi2290,项目名称:sample-Angular2,代码行数:19,代码来源:compile_element.ts


示例8: _processContentElement

  _processContentElement(current: CompileElement) {
    if (this._shadowDomStrategy.hasNativeContentElement()) {
      return;
    }
    var attrs = current.attrs();
    var selector = attrs.get('select');
    selector = isPresent(selector) ? selector : '';

    // The content tag should be replaced by a pair of marker tags (start & end).
    // The end marker creation is delayed to keep the number of elements constant.
    // Creating the end marker here would invalidate the parent's textNodeIndices for the subsequent
    // text nodes
    var contentStart = DOM.createScriptTag('type', 'ng/contentStart');
    if (assertionsEnabled()) {
      DOM.setAttribute(contentStart, 'select', selector);
    }
    DOM.insertBefore(current.element, contentStart);
    DOM.remove(current.element);

    current.element = contentStart;
    current.bindElement().setContentTagSelector(selector);
  }
开发者ID:adrianojdesouza,项目名称:angular,代码行数:22,代码来源:shadow_dom_compile_step.ts


示例9: compilerProviders

export function compilerProviders(): Array<Type | Provider | any[]> {
  return [
    Lexer,
    Parser,
    HtmlParser,
    TemplateParser,
    TemplateNormalizer,
    RuntimeMetadataResolver,
    StyleCompiler,
    CommandCompiler,
    ChangeDetectionCompiler,
    provide(ChangeDetectorGenConfig,
            {useValue: new ChangeDetectorGenConfig(assertionsEnabled(), false, true)}),
    TemplateCompiler,
    provide(RuntimeCompiler, {useClass: RuntimeCompiler_}),
    provide(Compiler, {useExisting: RuntimeCompiler}),
    DomElementSchemaRegistry,
    provide(ElementSchemaRegistry, {useExisting: DomElementSchemaRegistry}),
    AnchorBasedAppRootUrl,
    provide(AppRootUrl, {useExisting: AnchorBasedAppRootUrl}),
    UrlResolver
  ];
}
开发者ID:yjbanov,项目名称:angular,代码行数:23,代码来源:compiler.ts


示例10: createNgZone

export function createNgZone(): NgZone {
  return new NgZone({enableLongStackTrace: assertionsEnabled()});
}
开发者ID:goderbauer,项目名称:angular,代码行数:3,代码来源:application_common.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript lang.deserializeEnum函数代码示例发布时间:2022-05-25
下一篇:
TypeScript lang.addAnnotation函数代码示例发布时间: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