message_handler.d.ts 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. export class MessageHandler {
  2. constructor(sourceName: any, targetName: any, comObj: any);
  3. sourceName: any;
  4. targetName: any;
  5. comObj: any;
  6. callbackId: number;
  7. streamId: number;
  8. postMessageTransfers: boolean;
  9. streamSinks: any;
  10. streamControllers: any;
  11. callbackCapabilities: any;
  12. actionHandler: any;
  13. _onComObjOnMessage: (event: any) => void;
  14. on(actionName: any, handler: any): void;
  15. /**
  16. * Sends a message to the comObj to invoke the action with the supplied data.
  17. * @param {string} actionName - Action to call.
  18. * @param {JSON} data - JSON data to send.
  19. * @param {Array} [transfers] - List of transfers/ArrayBuffers.
  20. */
  21. send(actionName: string, data: JSON, transfers?: any[] | undefined): void;
  22. /**
  23. * Sends a message to the comObj to invoke the action with the supplied data.
  24. * Expects that the other side will callback with the response.
  25. * @param {string} actionName - Action to call.
  26. * @param {JSON} data - JSON data to send.
  27. * @param {Array} [transfers] - List of transfers/ArrayBuffers.
  28. * @returns {Promise} Promise to be resolved with response data.
  29. */
  30. sendWithPromise(actionName: string, data: JSON, transfers?: any[] | undefined): Promise<any>;
  31. /**
  32. * Sends a message to the comObj to invoke the action with the supplied data.
  33. * Expect that the other side will callback to signal 'start_complete'.
  34. * @param {string} actionName - Action to call.
  35. * @param {JSON} data - JSON data to send.
  36. * @param {Object} queueingStrategy - Strategy to signal backpressure based on
  37. * internal queue.
  38. * @param {Array} [transfers] - List of transfers/ArrayBuffers.
  39. * @returns {ReadableStream} ReadableStream to read data in chunks.
  40. */
  41. sendWithStream(actionName: string, data: JSON, queueingStrategy: Object, transfers?: any[] | undefined): ReadableStream;
  42. /**
  43. * @private
  44. */
  45. private _createStreamSink;
  46. /**
  47. * @private
  48. */
  49. private _processStreamMessage;
  50. /**
  51. * @private
  52. */
  53. private _deleteStreamController;
  54. /**
  55. * Sends raw message to the comObj.
  56. * @param {Object} message - Raw message.
  57. * @param transfers List of transfers/ArrayBuffers, or undefined.
  58. * @private
  59. */
  60. private _postMessage;
  61. destroy(): void;
  62. }