Capítulo 58 de 80
Since v4, connectivity detection no longer trusts navigator.onLine (unreliable, false negatives on Chromium) — it optimistically starts online: true and only updates from online/offline window events, which trades a small false-positive risk (serviceWorker-backed offline apps that actually work) for far fewer false negatives.
setEventListener(callback): replaces the default online/offline event source — receives a setOnline function to call with the new boolean state; used to wire alternative connectivity sources like React Native's NetInfo.subscribe(callback): notified with the current online boolean on every change — returns an unsubscribe.setOnline(online): force the online state directly.isOnline(): synchronously reads the current state.onlineManager.setEventListener((setOnline) =>
NetInfo.addEventListener((state) => setOnline(!!state.isConnected))
)
NetInfo as the connectivity source in place of the (browser-only) default.navigator.onLine-based detection — the library moved away from it deliberately due to Chromium false negatives.setEventListener wired to its own real connectivity signal.online/offlineFirst/always pause logic.NetInfo wiring.