当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript ListWrapper.createGrowableSize方法代码示例

本文整理汇总了TypeScript中angular2/src/facade/collection.ListWrapper.createGrowableSize方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ListWrapper.createGrowableSize方法的具体用法?TypeScript ListWrapper.createGrowableSize怎么用?TypeScript ListWrapper.createGrowableSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/src/facade/collection.ListWrapper的用法示例。


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

示例1: addToWindow

  addToWindow(registry: TestabilityRegistry): void {
    global.getAngularTestability = (elem: any, findInAncestors: boolean = true) => {
      var testability = registry.findTestabilityInTree(elem, findInAncestors);
      if (testability == null) {
        throw new Error('Could not find testability for element.');
      }
      return new PublicTestability(testability);
    };

    global.getAllAngularTestabilities = () => {
      var testabilities = registry.getAllTestabilities();
      return testabilities.map((testability) => { return new PublicTestability(testability); });
    };

    global.getAllAngularRootElements = () => registry.getAllRootElements();

    var whenAllStable = (callback) => {
      var testabilities = global.getAllAngularTestabilities();
      var count = testabilities.length;
      var didWork = false;
      var decrement = function(didWork_) {
        didWork = didWork || didWork_;
        count--;
        if (count == 0) {
          callback(didWork);
        }
      };
      testabilities.forEach(function(testability) { testability.whenStable(decrement); });
    };

    if (!global.frameworkStabilizers) {
      global.frameworkStabilizers = ListWrapper.createGrowableSize(0);
    }
    global.frameworkStabilizers.push(whenAllStable);
  }
开发者ID:JavaScript-Resource,项目名称:angular,代码行数:35,代码来源:testability.ts

示例2: queryFragments

function queryFragments(templateContent: Node, fragmentsRootNodeCount: number[]): Node[][] {
  var fragments = ListWrapper.createGrowableSize(fragmentsRootNodeCount.length);

  // Note: An explicit loop is the fastest way to convert a DOM array into a JS array!
  var childNode = DOM.firstChild(templateContent);
  for (var fragmentIndex = 0; fragmentIndex < fragments.length; fragmentIndex++) {
    var fragment = ListWrapper.createFixedSize(fragmentsRootNodeCount[fragmentIndex]);
    fragments[fragmentIndex] = fragment;
    // Note: the 2nd, 3rd, ... fragments are separated by each other via a '|'
    if (fragmentIndex >= 1) {
      childNode = DOM.nextSibling(childNode);
    }
    for (var i = 0; i < fragment.length; i++) {
      fragment[i] = childNode;
      childNode = DOM.nextSibling(childNode);
    }
  }
  return fragments;
}
开发者ID:goderbauer,项目名称:angular,代码行数:19,代码来源:util.ts


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