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


TypeScript event_serializer.serializeGenericEvent函数代码示例

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


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

示例1: dispatchRenderEvent

  dispatchRenderEvent(element: any, eventTarget: string, eventName: string, event: any): boolean {
    var serializedEvent;
    // TODO (jteplitz602): support custom events #3350
    switch (event.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(event);
        break;
      case 'keydown':
      case 'keypress':
      case 'keyup':
        serializedEvent = serializeKeyboardEvent(event);
        break;
      case 'input':
      case 'change':
      case 'blur':
        serializedEvent = serializeEventWithTarget(event);
        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 'scroll':
      case 'seeked':
      case 'seeking':
      case 'stalled':
      case 'submit':
      case 'success':
      case 'suspend':
      case 'timeupdate':
      case 'updateready':
      case 'visibilitychange':
      case 'volumechange':
      case 'waiting':
        serializedEvent = serializeGenericEvent(event);
        break;
      case 'transitionend':
        serializedEvent = serializeTransitionEvent(event);
        break;
      default:
        throw new BaseException(eventName + ' not supported on WebWorkers');
    }
    ObservableWrapper.callEmit(this._sink, {
      'element': this._serializer.serialize(element, RenderStoreObject),
      'eventName': eventName,
      'eventTarget': eventTarget,
      'event': serializedEvent
    });

    // 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:LordBinary,项目名称:angular,代码行数:94,代码来源:event_dispatcher.ts

示例2: dispatchRenderEvent

  dispatchRenderEvent(element: any, eventTarget: string, eventName: string, event: any): boolean {
    var serializedEvent;
    // TODO (jteplitz602): support custom events #3350
    switch (event.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(event);
        break;
      case "keydown":
      case "keypress":
      case "keyup":
        serializedEvent = serializeKeyboardEvent(event);
        break;
      case "input":
      case "change":
      case "blur":
        serializedEvent = serializeEventWithTarget(event);
        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 "scroll":
      case "seeked":
      case "seeking":
      case "stalled":
      case "submit":
      case "success":
      case "suspend":
      case "timeupdate":
      case "updateready":
      case "visibilitychange":
      case "volumechange":
      case "waiting":
        serializedEvent = serializeGenericEvent(event);
        break;
      default:
        throw new BaseException(eventName + " not supported on WebWorkers");
    }
    ObservableWrapper.callEmit(this._sink, {
      "element": this._serializer.serialize(element, RenderStoreObject),
      "eventName": eventName,
      "eventTarget": eventTarget,
      "event": serializedEvent
    });

    // 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:Konviser,项目名称:todo-list,代码行数:91,代码来源:event_dispatcher.ts

示例3: dispatchRenderEvent

  dispatchRenderEvent(elementIndex: number, eventName: string, locals: Map<string, any>) {
    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
    });
  }
开发者ID:KenWilliamson,项目名称:Angular2HostedMobileApp,代码行数:90,代码来源:event_dispatcher.ts


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