sendWithPromise(actionName, data, transfers) {
    const callbackId = this.callbackId++;
    const capability = Promise.withResolvers();
    this.callbackCapabilities[callbackId] = capability;
    try {
      this.comObj.postMessage(
        {
          sourceName: this.sourceName,
          targetName: this.targetName,
          action: actionName,
          callbackId,
          data,
        },
        transfers
      );
    } catch (ex) {
      capability.reject(ex);
    }
    return capability.promise;
  }
Sends a message to the comObj to invoke the action with the supplied data.
Expects that the other side will callback with the response.
@param {string} actionName - Action to call.
@param {JSON} data - JSON data to send.
@param {Array} [transfers] - List of transfers/ArrayBuffers.
@returns {Promise} Promise to be resolved with response data.