goldies
    Preparing search index...

    Function reloadPageWhenOnline

    • Reloads the page when the internet connection is restored. This is useful for Single Page Applications (SPAs) to ensure the app is in sync with the server after a connection loss.

      Parameters

      • windowObject: Window = window

        The window object to attach the event listener to. Defaults to the global window object.

      Returns void

      If windowObject is not provided and global window is undefined.

      // Using the global window object
      reloadPageWhenOnline();

      // Using a specific window object (useful for testing)
      reloadPageWhenOnline(customWindow);