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


TypeScript List.push方法代码示例

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


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

示例1: coalesce

export function coalesce(records: ProtoRecord[]): ProtoRecord[] {
  var res: List<ProtoRecord> = [];
  var indexMap: Map<number, number> = new Map<number, number>();

  for (var i = 0; i < records.length; ++i) {
    var r = records[i];
    var record = _replaceIndices(r, res.length + 1, indexMap);
    var matchingRecord = _findMatching(record, res);

    if (isPresent(matchingRecord) && record.lastInBinding) {
      res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1));
      indexMap.set(r.selfIndex, matchingRecord.selfIndex);
      matchingRecord.referencedBySelf = true;

    } else if (isPresent(matchingRecord) && !record.lastInBinding) {
      if (record.argumentToPureFunction) {
        matchingRecord.argumentToPureFunction = true;
      }

      indexMap.set(r.selfIndex, matchingRecord.selfIndex);

    } else {
      res.push(record);
      indexMap.set(r.selfIndex, record.selfIndex);
    }
  }

  return res;
}
开发者ID:goderbauer,项目名称:angular,代码行数:29,代码来源:coalesce.ts

示例2: _addRecord

 _addRecord(type, name, funcOrValue, args, fixedArgs, context) {
   var selfIndex = this._records.length + 1;
   if (context instanceof DirectiveIndex) {
     this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context,
                                        selfIndex, this._bindingRecord, this._expressionAsString,
                                        false, false));
   } else {
     this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null,
                                        selfIndex, this._bindingRecord, this._expressionAsString,
                                        false, false));
   }
   return selfIndex;
 }
开发者ID:jimthedev,项目名称:angular,代码行数:13,代码来源:proto_change_detector.ts

示例3: go

 go(url: string) {
   url = this.normalizeAbsolutely(url);
   if (this._path == url) {
     return;
   }
   this._path = url;
   this.urlChanges.push(url);
 }
开发者ID:Salim-K,项目名称:angular,代码行数:8,代码来源:location_mock.ts

示例4: whenStable

  whenStable(callback: Function) {
    this._callbacks.push(callback);

    if (this._pendingCount === 0) {
      this._runCallbacks();
    }
    // TODO(juliemr) - hook into the zone api.
  }
开发者ID:AsherBarak,项目名称:angular,代码行数:8,代码来源:testability.ts

示例5: _appendRecords

 _appendRecords(b: BindingRecord, variableNames: List<string>) {
   if (b.isDirectiveLifecycle()) {
     this.records.push(new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [],
                                       [], -1, null, this.records.length + 1, b, null, false,
                                       false));
   } else {
     _ConvertAstIntoProtoRecords.append(this.records, b, variableNames);
   }
 }
开发者ID:jimthedev,项目名称:angular,代码行数:9,代码来源:proto_change_detector.ts

示例6: readPerfLog

 readPerfLog(): Promise<any> {
   this._commandLog.push('readPerfLog');
   if (this._perfLogs.length > 0) {
     var next = this._perfLogs[0];
     ListWrapper.removeAt(this._perfLogs, 0);
     return PromiseWrapper.resolve(next);
   } else {
     return PromiseWrapper.resolve([]);
   }
 }
开发者ID:Salim-K,项目名称:angular,代码行数:10,代码来源:perflog_metric_spec.ts

示例7: _processStyleElement

  _processStyleElement(current: CompileElement, control: CompileControl) {
    var stylePromise = this._shadowDomStrategy.processStyleElement(
        this._template.componentId, this._template.templateAbsUrl, current.element);
    if (isPresent(stylePromise) && isPromise(stylePromise)) {
      this._subTaskPromises.push(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();
  }
开发者ID:Salim-K,项目名称:angular,代码行数:11,代码来源:shadow_dom_compile_step.ts

示例8: coalesce

export function coalesce(records: List<ProtoRecord>): List<ProtoRecord> {
  var res: List<ProtoRecord> = [];
  var indexMap: Map<number, number> = MapWrapper.create();

  for (var i = 0; i < records.length; ++i) {
    var r = records[i];
    var record = _replaceIndices(r, res.length + 1, indexMap);
    var matchingRecord = _findMatching(record, res);

    if (isPresent(matchingRecord) && record.lastInBinding) {
      res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1));
      MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);

    } else if (isPresent(matchingRecord) && !record.lastInBinding) {
      MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex);

    } else {
      res.push(record);
      MapWrapper.set(indexMap, r.selfIndex, record.selfIndex);
    }
  }

  return res;
}
开发者ID:AsherBarak,项目名称:angular,代码行数:24,代码来源:coalesce.ts

示例9: constructor

 constructor() {
   var appSize = getIntParameter('appSize');
   this.iterationCount = getIntParameter('iterationCount');
   this.scrollIncrement = getIntParameter('scrollIncrement');
   appSize = appSize > 1 ? appSize - 1 : 0;  // draw at least one table
   this.scrollAreas = [];
   for (var i = 0; i < appSize; i++) {
     this.scrollAreas.push(i);
   }
   bindAction('#run-btn', () => { this.runBenchmark(); });
   bindAction('#reset-btn', () => {
     this._getScrollDiv().scrollTop = 0;
     var existingMarker = this._locateFinishedMarker();
     if (isPresent(existingMarker)) {
       DOM.removeChild(document.body, existingMarker);
     }
   });
 }
开发者ID:cedriclam,项目名称:angular,代码行数:18,代码来源:app.ts

示例10: add

 add(thing: string) { this.log.push(thing); }
开发者ID:jimthedev,项目名称:angular,代码行数:1,代码来源:debug_element_spec.ts


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