Skip to content
Snippets Groups Projects
1.index.js 1.51 MiB
Newer Older
  • Learn to ignore specific revisions
  • Romain CREY's avatar
    Romain CREY committed
            (0, _util.assert)(this.streamControllers[data.streamId], 'close should have stream controller');
            if (this.streamControllers[data.streamId].isClosed) {
              break;
            }
            this.streamControllers[data.streamId].isClosed = true;
            this.streamControllers[data.streamId].controller.close();
            deleteStreamController();
            break;
          case 'error':
            (0, _util.assert)(this.streamControllers[data.streamId], 'error should have stream controller');
            this.streamControllers[data.streamId].controller.error(wrapReason(data.reason));
            deleteStreamController();
            break;
          case 'cancel_complete':
            resolveOrReject(this.streamControllers[data.streamId].cancelCall, data.success, wrapReason(data.reason));
            deleteStreamController();
            break;
          case 'cancel':
            if (!this.streamSinks[data.streamId]) {
              break;
            }
            resolveCall(this.streamSinks[data.streamId].onCancel, [wrapReason(data.reason)]).then(function () {
              sendStreamResponse({
                stream: 'cancel_complete',
                success: true
              });
            }, function (reason) {
              sendStreamResponse({
                stream: 'cancel_complete',
                success: false,
                reason: reason
              });
            });
            this.streamSinks[data.streamId].sinkCapability.reject(wrapReason(data.reason));
            this.streamSinks[data.streamId].isCancelled = true;
            delete this.streamSinks[data.streamId];
            break;
          default:
            throw new Error('Unexpected stream case');
        }
      },
      postMessage: function postMessage(message, transfers) {
        if (transfers && this.postMessageTransfers) {
          this.comObj.postMessage(message, transfers);
        } else {
          this.comObj.postMessage(message);
        }
      },
      destroy: function destroy() {
        this.comObj.removeEventListener('message', this._onComObjOnMessage);
      }
    };
    exports.MessageHandler = MessageHandler;
    
    /***/ })
    /******/ ]);
    });
    //# sourceMappingURL=pdf.worker.js.map
    
    /***/ })
    
    };;