@narumitw/pi-btw 0.56.0 → 0.56.1

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.
package/dist/index.ts CHANGED
@@ -693,9 +693,10 @@ var BtwFullscreenHost = class {
693
693
  disposed = false;
694
694
  finished = false;
695
695
  parentStopped = false;
696
- parentRestarted = false;
696
+ parentRestoreAttempted = false;
697
697
  fullscreenCreated = false;
698
698
  fullscreenStopped = false;
699
+ parentRestoreQueued = false;
699
700
  cleanupError;
700
701
  setParentOverlay(overlay) {
701
702
  this.parentOverlay = overlay;
@@ -728,7 +729,7 @@ var BtwFullscreenHost = class {
728
729
  try {
729
730
  this.hardCancelActiveCustom?.();
730
731
  } finally {
731
- this.restoreParent();
732
+ this.queueParentRestore();
732
733
  }
733
734
  return { consume: true };
734
735
  });
@@ -746,9 +747,22 @@ var BtwFullscreenHost = class {
746
747
  this.finished = true;
747
748
  this.done(outcome);
748
749
  }
750
+ queueParentRestore() {
751
+ if (this.parentRestoreQueued || this.parentRestoreAttempted) return;
752
+ this.parentRestoreQueued = true;
753
+ queueMicrotask(() => {
754
+ this.parentRestoreQueued = false;
755
+ this.restoreParent();
756
+ });
757
+ }
749
758
  restoreParent() {
750
- this.removeHardCancelListener?.();
759
+ const removeHardCancelListener = this.removeHardCancelListener;
751
760
  this.removeHardCancelListener = void 0;
761
+ try {
762
+ removeHardCancelListener?.();
763
+ } catch (error) {
764
+ this.cleanupError ??= error;
765
+ }
752
766
  if (this.fullscreenCreated && !this.fullscreenStopped) {
753
767
  this.fullscreenStopped = true;
754
768
  try {
@@ -757,7 +771,7 @@ var BtwFullscreenHost = class {
757
771
  this.cleanupError ??= error;
758
772
  }
759
773
  }
760
- if (!this.parentStopped || this.parentRestarted) return;
774
+ if (!this.parentStopped || this.parentRestoreAttempted) return;
761
775
  const parentOverlay = this.parentOverlay;
762
776
  this.parentOverlay = void 0;
763
777
  try {
@@ -766,8 +780,8 @@ var BtwFullscreenHost = class {
766
780
  this.cleanupError ??= error;
767
781
  }
768
782
  try {
783
+ this.parentRestoreAttempted = true;
769
784
  this.parent.start();
770
- this.parentRestarted = true;
771
785
  this.parent.renderNow(false);
772
786
  } catch (error) {
773
787
  this.cleanupError ??= error;