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
feat: Add ConnectionListener and a default browser implementation #305
Conversation
Thanks for this great PR! Unfortunately, branches not on this particular codebase don't get coverage automatically run. Can you run |
-------------------------------------------|---------|----------|---------|---------|-------------------
Test Suites: 28 passed, 28 total |
@@ -32,8 +35,15 @@ export default class PollingSubscription implements Subscription { | |||
this.url = url; | |||
this.frequencyHistogram.set(this.frequency, 1); | |||
this.dispatch = dispatch; | |||
if (isOnline()) this.update(); | |||
this.run(); |
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.
Hmm, doesn't this.run() still need to happen?
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.
It happens now by calling this.onlineListener() if we are online on line 43
Motivation
online & offline support was disabled in React Native.
Solution
Added a ConnectionListener which is now used by PollingSubscriptions that defaults to a browser implementation. Default implementation should be safe to run in non-browser environments, defaulting to previous behavior of just always saying things are online.
Open questions