cross-tab-worker-databus 0.20.90 → 0.20.92

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5132,8 +5132,8 @@ var CentrifugeSession = class {
5132
5132
  // Route credential fetches back to the main thread, where the
5133
5133
  // application's credentialProvider lives (config must stay
5134
5134
  // structured-cloneable, so functions cannot cross the boundary).
5135
- getToken: () => this.requestToken("token"),
5136
- getChannelToken: (channel) => this.requestToken("channelToken", channel)
5135
+ getToken: () => this.requestToken("token", lifecycle),
5136
+ getChannelToken: (channel) => this.requestToken("channelToken", lifecycle, channel)
5137
5137
  } : config;
5138
5138
  const client = new Centrifuge(url, clientOptions);
5139
5139
  this.client = client;
@@ -5252,15 +5252,13 @@ var CentrifugeSession = class {
5252
5252
  /** Issue a credential request to the main thread and await the response.
5253
5253
  * Used as Centrifuge's `getToken` / `getChannelToken` when token bridging is
5254
5254
  * enabled; resolved or rejected by a matching TOKEN_RESPONSE / TOKEN_ERROR. */
5255
- requestToken(kind, channel) {
5256
- const lifecycle = this.lifecycle;
5255
+ requestToken(kind, lifecycle, channel) {
5256
+ if (this.lifecycle !== lifecycle) {
5257
+ return Promise.reject(new Error("Centrifuge client lifecycle has ended before the credential was requested."));
5258
+ }
5257
5259
  const requestId = this.nextRequestId;
5258
5260
  this.nextRequestId += 1;
5259
5261
  return new Promise((resolve, reject) => {
5260
- if (this.lifecycle !== lifecycle) {
5261
- reject(new Error("Centrifuge session stopped before the credential was requested."));
5262
- return;
5263
- }
5264
5262
  this.pendingTokenRequests.set(requestId, { resolve, reject });
5265
5263
  this.post({
5266
5264
  type: CENTRIFUGE_OUTPUT_TYPE.TOKEN_REQUEST,