Skip to content

Conversation

majeed-platogo
Copy link

The block below is useful for handling autoconnection/disconnection when users leave or enter the tab

if (phxWindow && phxWindow.addEventListener) {
      phxWindow.addEventListener("pagehide", (_e) => {
        if (this.conn) {
          this.disconnect();
          awaitingConnectionOnPageShow = this.connectClock;
        }
      });
      phxWindow.addEventListener("pageshow", (_e) => {
        if (awaitingConnectionOnPageShow === this.connectClock) {
          awaitingConnectionOnPageShow = null;
          this.connect();
        }
      });
    }

But in our case, It clashes with our own listener that does this among other things. That's why we're introducing disableWindowEventListeners to make this optional

@majeed-platogo majeed-platogo force-pushed the change/optional-window-event-listeners branch from f0d39f0 to 82e69d7 Compare April 16, 2025 11:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant