-
Notifications
You must be signed in to change notification settings - Fork 888
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
Add ConnectivityMonitor #1808
Add ConnectivityMonitor #1808
Conversation
packages/firestore/src/platform_browser/browser_connectivity_monitor.ts
Outdated
Show resolved
Hide resolved
packages/firestore/src/platform_browser/browser_connectivity_monitor.ts
Outdated
Show resolved
Hide resolved
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
* that each platform will have its own system-dependent implementation. | ||
*/ | ||
export interface ConnectivityMonitor { | ||
addCallback(callback: ConnectivityMonitorCallback): void; |
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.
More comments on what these do please.
Specifically, does the callback get called on the initial state?
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.
Just as a note, we ended up disabling online/offline monitoring for RTDB on Cordova (
// We've had repeated complaints that Cordova apps can get stuck "offline", e.g. |
} | ||
|
||
private configureNetworkMonitoring(): void { | ||
window.addEventListener('online', this.networkAvailableListener); |
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.
@thebrianchen I believe we need to fix this still as per our earlier discussion.
Ideally, you would change BrowserWindow to only return BrowserConnectivityMonitor if window
is defined. The smaller fix would be to add a typeof window !== undefined
check here. As merged, I believe this change will cause issues on Electron and other browser-like environments.
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.
This is probably causing issue #1824.
No description provided.