cross-tab-worker-databus 0.21.22 → 0.21.24

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.
@@ -837,7 +837,7 @@ var WorkerClusterRuntime = class {
837
837
  */
838
838
  stop() {
839
839
  this.lifecycleGeneration += 1;
840
- if (!this.started && !this.suspended) return;
840
+ if (!this.started && !this.suspended && !this.lifecycleListening) return;
841
841
  this.pause();
842
842
  this.flushStorage();
843
843
  this.removeLifecycleListeners();
@@ -865,6 +865,12 @@ var WorkerClusterRuntime = class {
865
865
  this.channel = null;
866
866
  }
867
867
  if (!this.channel) this.storage = null;
868
+ if (!this.started) {
869
+ const channel = this.channel;
870
+ this.channel = null;
871
+ channel?.close();
872
+ return;
873
+ }
868
874
  this.channel?.addEventListener("message", this.handleMessage);
869
875
  const now = this.environment.now();
870
876
  this.currentRecord = {
@@ -880,6 +886,7 @@ var WorkerClusterRuntime = class {
880
886
  if (!this.storage) this.sendControl(this.workerId, CONTROL_ACTION.SUBSCRIBE, topic, topicKey);
881
887
  else this.writeSubscriber(topicKey);
882
888
  }
889
+ if (!this.started) return;
883
890
  this.reconcile();
884
891
  this.heartbeatHandle = this.environment.setInterval(() => {
885
892
  this.writeRecord(false);
@@ -2579,7 +2586,7 @@ var SDK_VERSION = (
2579
2586
  // declaration's type is `string | undefined` and the export's is `string`
2580
2587
  // (dropping the conditional is TS2322, measured). Recorded here so the leg reads
2581
2588
  // as a shape the harness cannot reach rather than as a case nobody exercised.
2582
- true ? "0.21.22" : ""
2589
+ true ? "0.21.24" : ""
2583
2590
  );
2584
2591
 
2585
2592
  // src/core/data-bus.ts