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


TypeScript StringMapWrapper.create方法代码示例

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


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

示例1: it

 it('should merge values in provided dictionary', () => {
   var map = StringMapWrapper.create();
   StringMapWrapper.set(map, 'foo', 'bar');
   var headers = new Headers(map);
   expect(headers.get('foo')).toBe('bar');
   expect(headers.getAll('foo')).toEqual(['bar']);
 });
开发者ID:hankduan,项目名称:angular,代码行数:7,代码来源:headers_spec.ts

示例2: parseEventName

  static parseEventName(eventName: string): {[key: string]: string} {
    var parts: string[] = eventName.toLowerCase().split('.');

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

    var key = KeyEventsPlugin._normalizeKey(parts.pop());

    var fullKey = '';
    modifierKeys.forEach(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:beta3000,项目名称:hola-angular2,代码行数:30,代码来源:key_events.ts

示例3: createMetric

 function createMetric(perfLogs, microMetrics = null, perfLogFeatures = null, forceGc = null,
                       captureFrames = null) {
   commandLog = [];
   if (isBlank(perfLogFeatures)) {
     perfLogFeatures = new PerfLogFeatures({render: true, gc: true, frameCapture: true});
   }
   if (isBlank(microMetrics)) {
     microMetrics = StringMapWrapper.create();
   }
   var bindings = [
     Options.DEFAULT_PROVIDERS,
     PerflogMetric.BINDINGS,
     bind(Options.MICRO_METRICS).toValue(microMetrics),
     bind(PerflogMetric.SET_TIMEOUT)
         .toValue((fn, millis) => {
           commandLog.push(['setTimeout', millis]);
           fn();
         }),
     bind(WebDriverExtension)
         .toValue(new MockDriverExtension(perfLogs, commandLog, perfLogFeatures))
   ];
   if (isPresent(forceGc)) {
     bindings.push(bind(Options.FORCE_GC).toValue(forceGc));
   }
   if (isPresent(captureFrames)) {
     bindings.push(bind(Options.CAPTURE_FRAMES).toValue(captureFrames));
   }
   return Injector.resolveAndCreate(bindings).get(PerflogMetric);
 }
开发者ID:hankduan,项目名称:angular,代码行数:29,代码来源:perflog_metric_spec.ts

示例4: dispatchRenderEvent

  dispatchRenderEvent(elementIndex: number, eventName: string, locals: Map<string, any>): boolean {
    var e = locals.get('$event');
    var serializedEvent;
    // TODO (jteplitz602): support custom events #3350
    switch (e.type) {
      case "click":
      case "mouseup":
      case "mousedown":
      case "dblclick":
      case "contextmenu":
      case "mouseenter":
      case "mouseleave":
      case "mousemove":
      case "mouseout":
      case "mouseover":
      case "show":
        serializedEvent = serializeMouseEvent(e);
        break;
      case "keydown":
      case "keypress":
      case "keyup":
        serializedEvent = serializeKeyboardEvent(e);
        break;
      case "input":
      case "change":
      case "blur":
        serializedEvent = serializeEventWithTarget(e);
        break;
      case "abort":
      case "afterprint":
      case "beforeprint":
      case "cached":
      case "canplay":
      case "canplaythrough":
      case "chargingchange":
      case "chargingtimechange":
      case "close":
      case "dischargingtimechange":
      case "DOMContentLoaded":
      case "downloading":
      case "durationchange":
      case "emptied":
      case "ended":
      case "error":
      case "fullscreenchange":
      case "fullscreenerror":
      case "invalid":
      case "languagechange":
      case "levelfchange":
      case "loadeddata":
      case "loadedmetadata":
      case "obsolete":
      case "offline":
      case "online":
      case "open":
      case "orientatoinchange":
      case "pause":
      case "pointerlockchange":
      case "pointerlockerror":
      case "play":
      case "playing":
      case "ratechange":
      case "readystatechange":
      case "reset":
      case "seeked":
      case "seeking":
      case "stalled":
      case "submit":
      case "success":
      case "suspend":
      case "timeupdate":
      case "updateready":
      case "visibilitychange":
      case "volumechange":
      case "waiting":
        serializedEvent = serializeGenericEvent(e);
        break;
      default:
        throw new BaseException(eventName + " not supported on WebWorkers");
    }
    var serializedLocals = StringMapWrapper.create();
    StringMapWrapper.set(serializedLocals, '$event', serializedEvent);

    ObservableWrapper.callNext(this._sink, {
      "viewRef": this._serializer.serialize(this._viewRef, RenderViewRef),
      "elementIndex": elementIndex,
      "eventName": eventName,
      "locals": serializedLocals
    });

    // TODO(kegluneq): Eventually, we want the user to indicate from the UI side whether the event
    // should be canceled, but for now just call `preventDefault` on the original DOM event.
    return false;
  }
开发者ID:beta3000,项目名称:hola-angular2,代码行数:94,代码来源:event_dispatcher.ts


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