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

TypeScript serializer.Serializer类代码示例

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

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



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

示例1: catch

 PromiseWrapper.then(promise, (result: any) => {
   try {
     this._sendWebWorkerMessage("result", this._serializer.serialize(result, type), id);
   } catch (e) {
     print(e);
   }
 }, (error: any) => { this._sendWebWorkerError(id, error); });
开发者ID:goderbauer,项目名称:angular,代码行数:7,代码来源:impl.ts


示例2: _handleCompilerMessage

 // TODO: Transfer the types with the serialized data so this can be automated?
 private _handleCompilerMessage(data: ReceivedMessage) {
   var promise: Promise<any>;
   switch (data.method) {
     case "compileHost":
       var directiveMetadata = this._serializer.deserialize(data.args[0], DirectiveMetadata);
       promise = this._renderCompiler.compileHost(directiveMetadata);
       this._wrapWebWorkerPromise(data.id, promise, ProtoViewDto);
       break;
     case "compile":
       var view = this._serializer.deserialize(data.args[0], ViewDefinition);
       promise = this._renderCompiler.compile(view);
       this._wrapWebWorkerPromise(data.id, promise, ProtoViewDto);
       break;
     case "mergeProtoViewsRecursively":
       var views = this._serializer.deserialize(data.args[0], RenderProtoViewRef);
       promise = this._renderCompiler.mergeProtoViewsRecursively(views);
       this._wrapWebWorkerPromise(data.id, promise, RenderProtoViewMergeMapping);
       break;
     default:
       throw new BaseException("not implemented");
   }
 }
开发者ID:goderbauer,项目名称:angular,代码行数:23,代码来源:impl.ts


示例3: _createViewHelper

 private _createViewHelper(args: List<any>, method) {
   var hostProtoView = this._serializer.deserialize(args[0], RenderProtoViewRef);
   var fragmentCount = args[1];
   var startIndex, renderViewWithFragments;
   if (method == "createView") {
     startIndex = args[2];
     renderViewWithFragments = this._renderer.createView(hostProtoView, fragmentCount);
   } else {
     var selector = args[2];
     startIndex = args[3];
     renderViewWithFragments =
         this._renderer.createRootHostView(hostProtoView, fragmentCount, selector);
   }
   this._renderViewWithFragmentsStore.store(renderViewWithFragments, startIndex);
 }
开发者ID:goderbauer,项目名称:angular,代码行数:15,代码来源:impl.ts


示例4: BaseException

  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);

    this._sink.send({
      "type": "event",
      "value": {
        "viewRef": this._serializer.serialize(this._viewRef, RenderViewRef),
        "elementIndex": elementIndex,
        "eventName": eventName,
        "locals": serializedLocals
      }
    });
  }
开发者ID:goderbauer,项目名称:angular,代码行数:93,代码来源:impl.ts


示例5: _handleRendererMessage

 private _handleRendererMessage(data: ReceivedMessage) {
   var args = data.args;
   switch (data.method) {
     case "createRootHostView":
     case "createView":
       this._createViewHelper(args, data.method);
       break;
     case "destroyView":
       var viewRef = this._serializer.deserialize(args[0], RenderViewRef);
       this._renderer.destroyView(viewRef);
       break;
     case "attachFragmentAfterFragment":
       var previousFragment = this._serializer.deserialize(args[0], RenderFragmentRef);
       var fragment = this._serializer.deserialize(args[1], RenderFragmentRef);
       this._renderer.attachFragmentAfterFragment(previousFragment, fragment);
       break;
     case "attachFragmentAfterElement":
       var element = this._serializer.deserialize(args[0], WebWorkerElementRef);
       var fragment = this._serializer.deserialize(args[1], RenderFragmentRef);
       this._renderer.attachFragmentAfterElement(element, fragment);
       break;
     case "detachFragment":
       var fragment = this._serializer.deserialize(args[0], RenderFragmentRef);
       this._renderer.detachFragment(fragment);
       break;
     case "hydrateView":
       var viewRef = this._serializer.deserialize(args[0], RenderViewRef);
       this._renderer.hydrateView(viewRef);
       break;
     case "dehydrateView":
       var viewRef = this._serializer.deserialize(args[0], RenderViewRef);
       this._renderer.dehydrateView(viewRef);
       break;
     case "setText":
       var viewRef = this._serializer.deserialize(args[0], RenderViewRef);
       var textNodeIndex = args[1];
       var text = args[2];
       this._renderer.setText(viewRef, textNodeIndex, text);
       break;
     case "setElementProperty":
       var elementRef = this._serializer.deserialize(args[0], WebWorkerElementRef);
       var propName = args[1];
       var propValue = args[2];
       this._renderer.setElementProperty(elementRef, propName, propValue);
       break;
     case "setElementAttribute":
       var elementRef = this._serializer.deserialize(args[0], WebWorkerElementRef);
       var attributeName = args[1];
       var attributeValue = args[2];
       this._renderer.setElementAttribute(elementRef, attributeName, attributeValue);
       break;
     case "setElementClass":
       var elementRef = this._serializer.deserialize(args[0], WebWorkerElementRef);
       var className = args[1];
       var isAdd = args[2];
       this._renderer.setElementClass(elementRef, className, isAdd);
       break;
     case "setElementStyle":
       var elementRef = this._serializer.deserialize(args[0], WebWorkerElementRef);
       var styleName = args[1];
       var styleValue = args[2];
       this._renderer.setElementStyle(elementRef, styleName, styleValue);
       break;
     case "invokeElementMethod":
       var elementRef = this._serializer.deserialize(args[0], WebWorkerElementRef);
       var methodName = args[1];
       var methodArgs = args[2];
       this._renderer.invokeElementMethod(elementRef, methodName, methodArgs);
       break;
     case "setEventDispatcher":
       var viewRef = this._serializer.deserialize(args[0], RenderViewRef);
       var dispatcher = new EventDispatcher(viewRef, this._bus.sink, this._serializer);
       this._renderer.setEventDispatcher(viewRef, dispatcher);
       break;
     default:
       throw new BaseException("Not Implemented");
   }
 }
开发者ID:goderbauer,项目名称:angular,代码行数:78,代码来源:impl.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap