Skip to content

Commit

Permalink
[BUG] Telemetry Buffer Getting Cleared in Offline Mode - Online Statu…
Browse files Browse the repository at this point in the history
…s Incorrectly Initialized in Offline Listener #1538
  • Loading branch information
MSNev committed Apr 21, 2021
1 parent 7d9aa0e commit b36cb13
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions channels/applicationinsights-channel-js/src/Offline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ export class OfflineListener {
target.ononline = _setOnline;
target.onoffline = _setOffline
isListening = true;

}
}

if (isListening) {
// We are listening to events so lets set the current status rather than assuming we are online #1538
var _navigator = getNavigator(); // Gets the window.navigator or workerNavigator depending on the global
if (_navigator && !isNullOrUndefined(_navigator.onLine)) { // navigator.onLine is undefined in react-native
_onlineStatus = _navigator.onLine;
}
}
} catch (e) {
Expand Down

0 comments on commit b36cb13

Please sign in to comment.