-
Notifications
You must be signed in to change notification settings - Fork 0
660 Allow user to define network status handler #671
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| mocks: { | ||
| handlers: import("../mocks/browser.js"), | ||
| }, | ||
| network: { |
There was a problem hiding this comment.
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.
packages/radfish/index.js
Outdated
| this._registerEventListeners(); | ||
|
|
||
| // Check initial network status if handler provided | ||
| if (this._networkHandler) { |
There was a problem hiding this comment.
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.
JCopeland-PIFSC
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM ✅
issue #660
Custom Network Handler:
Introduces a new
networkproperty allowing users to provide a customsetIsOnlinefunction for checking connectivity. If provided, it overrides the defaultnavigator.onLinecheck.Event Handling:
Updates the application to use browser
online/offlineevents. If a custom handler exists, it verifies connectivity before dispatching"online"or"offline"events; otherwise, it falls back tonavigator.onLine.React Integration:
The network status updates are consumed by the React hook
useOfflineStatusto update the UI.