Skip to content

Conversation

@jaygiang
Copy link
Collaborator

issue #660

  • Custom Network Handler:
    Introduces a new network property allowing users to provide a custom setIsOnline function for checking connectivity. If provided, it overrides the default navigator.onLine check.

  • Event Handling:
    Updates the application to use browser online/offline events. If a custom handler exists, it verifies connectivity before dispatching "online" or "offline" events; otherwise, it falls back to navigator.onLine.

  • React Integration:
    The network status updates are consumed by the React hook useOfflineStatus to update the UI.

@jaygiang jaygiang requested a review from thgaskell February 25, 2025 06:41
@jaygiang jaygiang linked an issue Mar 6, 2025 that may be closed by this pull request
thgaskell
thgaskell previously approved these changes Sep 11, 2025
mocks: {
handlers: import("../mocks/browser.js"),
},
network: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default template shouldn't set a handler for the developer.

this._registerEventListeners();

// Check initial network status if handler provided
if (this._networkHandler) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should check if options.network.onChange is a function.

Copy link
Contributor

@JCopeland-PIFSC JCopeland-PIFSC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✅

thgaskell
thgaskell previously approved these changes Sep 17, 2025
@jaygiang jaygiang requested a review from thgaskell December 9, 2025 00:23
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.

Allow user to define network status handler

4 participants