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.
@@ -871,7 +871,7 @@ var WorkerClusterRuntime = class {
871
871
  */
872
872
  stop() {
873
873
  this.lifecycleGeneration += 1;
874
- if (!this.started && !this.suspended) return;
874
+ if (!this.started && !this.suspended && !this.lifecycleListening) return;
875
875
  this.pause();
876
876
  this.flushStorage();
877
877
  this.removeLifecycleListeners();
@@ -899,6 +899,12 @@ var WorkerClusterRuntime = class {
899
899
  this.channel = null;
900
900
  }
901
901
  if (!this.channel) this.storage = null;
902
+ if (!this.started) {
903
+ const channel = this.channel;
904
+ this.channel = null;
905
+ channel?.close();
906
+ return;
907
+ }
902
908
  this.channel?.addEventListener("message", this.handleMessage);
903
909
  const now = this.environment.now();
904
910
  this.currentRecord = {
@@ -914,6 +920,7 @@ var WorkerClusterRuntime = class {
914
920
  if (!this.storage) this.sendControl(this.workerId, CONTROL_ACTION.SUBSCRIBE, topic, topicKey);
915
921
  else this.writeSubscriber(topicKey);
916
922
  }
923
+ if (!this.started) return;
917
924
  this.reconcile();
918
925
  this.heartbeatHandle = this.environment.setInterval(() => {
919
926
  this.writeRecord(false);
@@ -2613,7 +2620,7 @@ var SDK_VERSION = (
2613
2620
  // declaration's type is `string | undefined` and the export's is `string`
2614
2621
  // (dropping the conditional is TS2322, measured). Recorded here so the leg reads
2615
2622
  // as a shape the harness cannot reach rather than as a case nobody exercised.
2616
- true ? "0.21.22" : ""
2623
+ true ? "0.21.24" : ""
2617
2624
  );
2618
2625
 
2619
2626
  // src/core/data-bus.ts