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

TypeScript collection.ListWrapper类代码示例

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

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



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

示例1: parseEventName

  static parseEventName(eventName: string): StringMap<string, string> {
    var parts = eventName.toLowerCase().split('.');

    var domEventName = ListWrapper.removeAt(parts, 0);
    if ((parts.length === 0) ||
        !(StringWrapper.equals(domEventName, 'keydown') ||
          StringWrapper.equals(domEventName, 'keyup'))) {
      return null;
    }

    var key = KeyEventsPlugin._normalizeKey(ListWrapper.removeLast(parts));

    var fullKey = '';
    ListWrapper.forEach(modifierKeys, (modifierName) => {
      if (ListWrapper.contains(parts, modifierName)) {
        ListWrapper.remove(parts, modifierName);
        fullKey += modifierName + '.';
      }
    });
    fullKey += key;

    if (parts.length != 0 || key.length === 0) {
      // returning null instead of throwing to let another plugin process the event
      return null;
    }
    var result = StringMapWrapper.create();
    StringMapWrapper.set(result, 'domEventName', domEventName);
    StringMapWrapper.set(result, 'fullKey', fullKey);
    return result;
  }
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:30,代码来源:key_events.ts


示例2: it

 it('should return the last sampleSize runs when the regression slope is >0', () => {
   createValidator({size: 2, metric: 'script'});
   var sample = [mv(0, 0, {'script': 1}), mv(1, 1, {'script': 2}), mv(2, 2, {'script': 3})];
   expect(validator.validate(ListWrapper.slice(sample, 0, 2)))
       .toEqual(ListWrapper.slice(sample, 0, 2));
   expect(validator.validate(sample)).toEqual(ListWrapper.slice(sample, 1, 3));
 });
开发者ID:hankduan,项目名称:angular,代码行数:7,代码来源:regression_slope_validator_spec.ts


示例3: it

 it('should return the last sampleSize runs when it has at least the given size', () => {
   createValidator(2);
   var sample = [mv(0, 0, {'a': 1}), mv(1, 1, {'b': 2}), mv(2, 2, {'c': 3})];
   expect(validator.validate(ListWrapper.slice(sample, 0, 2)))
       .toEqual(ListWrapper.slice(sample, 0, 2));
   expect(validator.validate(sample)).toEqual(ListWrapper.slice(sample, 1, 3));
 });
开发者ID:hankduan,项目名称:angular,代码行数:7,代码来源:size_validator_spec.ts


示例4: constructResolvingPath

function constructResolvingPath(keys: any[]): string {
  if (keys.length > 1) {
    var reversed = findFirstClosedCycle(ListWrapper.reversed(keys));
    var tokenStrs = ListWrapper.map(reversed, (k) => stringify(k.token));
    return " (" + tokenStrs.join(' -> ') + ")";
  } else {
    return "";
  }
}
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:9,代码来源:exceptions.ts


示例5: _addFrameMetrics

 _addFrameMetrics(result: {[key: string]: any}, frameTimes: any[]) {
   result['frameTime.mean'] =
       ListWrapper.reduce(frameTimes, (a, b) => a + b, 0) / frameTimes.length;
   var firstFrame = frameTimes[0];
   result['frameTime.worst'] = ListWrapper.reduce(frameTimes, (a, b) => a > b ? a : b, firstFrame);
   result['frameTime.best'] = ListWrapper.reduce(frameTimes, (a, b) => a < b ? a : b, firstFrame);
   result['frameTime.smooth'] =
       ListWrapper.filter(frameTimes, (a) => a < _FRAME_TIME_SMOOTH_THRESHOLD).length /
       frameTimes.length;
 }
开发者ID:hankduan,项目名称:angular,代码行数:10,代码来源:perflog_metric.ts


示例6: all

  static all(debugElement: DebugElement): DebugElement[] {
    var scope = [];
    scope.push(debugElement);

    ListWrapper.forEach(debugElement.children,
                        (child) => { scope = scope.concat(Scope.all(child)); });

    ListWrapper.forEach(debugElement.componentViewChildren,
                        (child) => { scope = scope.concat(Scope.all(child)); });

    return scope;
  }
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:12,代码来源:debug_element.ts


示例7: it

      it('should detect changes in list', () => {
        let l = [];
        differ.check(l);

        l.push('a');
        differ.check(l);
        expect(differ.toString())
            .toEqual(
                iterableChangesAsString({collection: ['a[null->0]'], additions: ['a[null->0]']}));

        l.push('b');
        differ.check(l);
        expect(differ.toString())
            .toEqual(iterableChangesAsString(
                {collection: ['a', 'b[null->1]'], previous: ['a'], additions: ['b[null->1]']}));

        l.push('c');
        l.push('d');
        differ.check(l);
        expect(differ.toString())
            .toEqual(iterableChangesAsString({
              collection: ['a', 'b', 'c[null->2]', 'd[null->3]'],
              previous: ['a', 'b'],
              additions: ['c[null->2]', 'd[null->3]']
            }));

        ListWrapper.removeAt(l, 2);
        differ.check(l);
        expect(differ.toString())
            .toEqual(iterableChangesAsString({
              collection: ['a', 'b', 'd[3->2]'],
              previous: ['a', 'b', 'c[2->null]', 'd[3->2]'],
              moves: ['d[3->2]'],
              removals: ['c[2->null]']
            }));

        ListWrapper.clear(l);
        l.push('d');
        l.push('c');
        l.push('b');
        l.push('a');
        differ.check(l);
        expect(differ.toString())
            .toEqual(iterableChangesAsString({
              collection: ['d[2->0]', 'c[null->1]', 'b[1->2]', 'a[0->3]'],
              previous: ['a[0->3]', 'b[1->2]', 'd[2->0]'],
              additions: ['c[null->1]'],
              moves: ['d[2->0]', 'b[1->2]', 'a[0->3]']
            }));
      });
开发者ID:hankduan,项目名称:angular,代码行数:50,代码来源:default_iterable_differ_spec.ts


示例8: add

 add(b: BindingRecord, variableNames: string[], bindingIndex: number) {
   var oldLast = ListWrapper.last(this.records);
   if (isPresent(oldLast) && oldLast.bindingRecord.directiveRecord == b.directiveRecord) {
     oldLast.lastInDirective = false;
   }
   var numberOfRecordsBefore = this.records.length;
   this._appendRecords(b, variableNames, bindingIndex);
   var newLast = ListWrapper.last(this.records);
   if (isPresent(newLast) && newLast !== oldLast) {
     newLast.lastInBinding = true;
     newLast.lastInDirective = true;
     this._setArgumentToPureFunction(numberOfRecordsBefore);
   }
 }
开发者ID:hankduan,项目名称:angular,代码行数:14,代码来源:proto_change_detector.ts


示例9: _addEvents

 _addEvents(events: { [key: string]: string }[]) {
   var needSort = false;
   events.forEach(event => {
     if (StringWrapper.equals(event['ph'], 'X')) {
       needSort = true;
       var startEvent = {};
       var endEvent = {};
       StringMapWrapper.forEach(event, (value, prop) => {
         startEvent[prop] = value;
         endEvent[prop] = value;
       });
       startEvent['ph'] = 'B';
       endEvent['ph'] = 'E';
       endEvent['ts'] = startEvent['ts'] + startEvent['dur'];
       this._remainingEvents.push(startEvent);
       this._remainingEvents.push(endEvent);
     } else {
       this._remainingEvents.push(event);
     }
   });
   if (needSort) {
     // Need to sort because of the ph==='X' events
     ListWrapper.sort(this._remainingEvents, (a, b) => {
       var diff = a['ts'] - b['ts'];
       return diff > 0 ? 1 : diff < 0 ? -1 : 0;
     });
   }
 }
开发者ID:hankduan,项目名称:angular,代码行数:28,代码来源:perflog_metric.ts


示例10: visitAll

 visitAll(asts: any[]): any[] {
   var res = ListWrapper.createFixedSize(asts.length);
   for (var i = 0; i < asts.length; ++i) {
     res[i] = asts[i].visit(this);
   }
   return res;
 }
开发者ID:chiragjraval,项目名称:AdvisroySystemPOC,代码行数:7,代码来源:ast.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript collection.Map类代码示例发布时间:2022-05-25
下一篇:
TypeScript browser.History类代码示例发布时间: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