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


TypeScript Map.set方法代码示例

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


在下文中一共展示了Map.set方法的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: viewCreated

 viewCreated(view: AppView) {
   var viewId = _nextId++;
   _allViewsById.set(viewId, view);
   _allIdsByView.set(view, viewId);
   for (var i = 0; i < view.elementRefs.length; i++) {
     _setElementId(this._renderer.getNativeElementSync(view.elementRefs[i]), [viewId, i]);
   }
 }
开发者ID:cedriclam,项目名称:angular,代码行数:8,代码来源:debug_element_view_listener.ts

示例3: onViewCreated

 onViewCreated(view: AppView) {
   var viewId = _nextId++;
   _allViewsById.set(viewId, view);
   _allIdsByView.set(view, viewId);
   for (var i = 0; i < view.appElements.length; i++) {
     var el = view.appElements[i];
     _setElementId(el.nativeElement, [viewId, i]);
   }
 }
开发者ID:Konviser,项目名称:todo-list,代码行数:9,代码来源:debug_element_view_listener.ts

示例4: viewCreated

 viewCreated(view: AppView) {
   var viewId = _nextId++;
   _allViewsById.set(viewId, view);
   _allIdsByView.set(view, viewId);
   var renderView = resolveInternalDomView(view.render);
   for (var i = 0; i < renderView.boundElements.length; i++) {
     _setElementId(renderView.boundElements[i].element, [viewId, i]);
   }
 }
开发者ID:Salim-K,项目名称:angular,代码行数:9,代码来源:debug_element_view_listener.ts

示例5: addEventListener

 addEventListener(element, eventName: string, handler: Function, shouldSupportBubble: boolean) {
   if (shouldSupportBubble) {
     this._bubbleEventHandlers.set(eventName, handler);
   } else {
     this._nonBubbleEventHandlers.set(eventName, handler);
   }
   return () => {
     MapWrapper.delete(
         shouldSupportBubble ? this._bubbleEventHandlers : this._nonBubbleEventHandlers, eventName)
   };
 }
开发者ID:Salim-K,项目名称:angular,代码行数:11,代码来源:event_manager_spec.ts

示例6: if

 MapWrapper.forEach(host, (value: string, key: string) => {
   var matches = RegExpWrapper.firstMatch(hostRegExp, key);
   if (isBlank(matches)) {
     hostAttributes.set(key, value);
   } else if (isPresent(matches[1])) {
     hostProperties.set(matches[1], value);
   } else if (isPresent(matches[2])) {
     hostListeners.set(matches[2], value);
   } else if (isPresent(matches[3])) {
     hostActions.set(matches[3], value);
   }
 });
开发者ID:Salim-K,项目名称:angular,代码行数:12,代码来源:api.ts

示例7: addConfig

 addConfig(path: string, handler: any, alias: string = null): void {
   var recognizer = new PathRecognizer(path, handler);
   MapWrapper.forEach(this.matchers, (matcher, _) => {
     if (recognizer.regex.toString() == matcher.regex.toString()) {
       throw new BaseException(
           `Configuration '${path}' conflicts with existing route '${matcher.path}'`);
     }
   });
   this.matchers.set(recognizer.regex, recognizer);
   if (isPresent(alias)) {
     this.names.set(alias, recognizer);
   }
 }
开发者ID:adrianojdesouza,项目名称:angular,代码行数:13,代码来源:route_recognizer.ts

示例8: config

  /**
   * Given a component and a configuration object, add the route to this registry
   */
  config(parentComponent, config: StringMap<string, any>): void {
    assertValidConfig(config);

    var recognizer: RouteRecognizer = this._rules.get(parentComponent);

    if (isBlank(recognizer)) {
      recognizer = new RouteRecognizer();
      this._rules.set(parentComponent, recognizer);
    }

    if (StringMapWrapper.contains(config, 'redirectTo')) {
      recognizer.addRedirect(config['path'], config['redirectTo']);
      return;
    }

    config = StringMapWrapper.merge(
        config, {'component': normalizeComponentDeclaration(config['component'])});

    var component = config['component'];
    var terminal = recognizer.addConfig(config['path'], config, config['as']);

    if (component['type'] == 'constructor') {
      if (terminal) {
        assertTerminalComponent(component['constructor'], config['path']);
      } else {
        this.configFromComponent(component['constructor']);
      }
    }
  }
开发者ID:Salim-K,项目名称:angular,代码行数:32,代码来源:route_registry.ts

示例9: coalesce

export function coalesce(srcRecords: ProtoRecord[]): ProtoRecord[] {
  let dstRecords = [];
  let excludedIdxs = [];
  let indexMap: Map<number, number> = new Map<number, number>();
  let skipDepth = 0;
  let skipSources: ProtoRecord[] = ListWrapper.createFixedSize(srcRecords.length);

  for (let protoIndex = 0; protoIndex < srcRecords.length; protoIndex++) {
    let skipRecord = skipSources[protoIndex];
    if (isPresent(skipRecord)) {
      skipDepth--;
      skipRecord.fixedArgs[0] = dstRecords.length;
    }

    let src = srcRecords[protoIndex];
    let dst = _cloneAndUpdateIndexes(src, dstRecords, indexMap);

    if (dst.isSkipRecord()) {
      dstRecords.push(dst);
      skipDepth++;
      skipSources[dst.fixedArgs[0]] = dst;
    } else {
      let record = _mayBeAddRecord(dst, dstRecords, excludedIdxs, skipDepth > 0);
      indexMap.set(src.selfIndex, record.selfIndex);
    }
  }

  return _optimizeSkips(dstRecords);
}
开发者ID:0oAimZo0,项目名称:Angular2Learning,代码行数:29,代码来源:coalesce.ts

示例10: function

 ListWrapper.forEach(bindings, function(b) {
   if (b instanceof ResolvedBinding) {
     res.set(b.key.id, b);
   } else if (b instanceof List) {
     _flattenBindings(b, res);
   }
 });
开发者ID:Salim-K,项目名称:angular,代码行数:7,代码来源:injector.ts


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