Monitor real-time network status changes (WiFi, Cellular, Offline).
Check network online status and listen to real-time connection type changes (WiFi / Cellular / Offline). More reliable than the browser navigator.onLine property.
import nativine from 'nativine';
const { online, type } = await nativine.network.isOnline();
// type -> 'wifi', 'cellular', or 'none'
Register a callback that fires whenever the connection state changes:
import nativine from 'nativine';
nativine.network.onConnectivityChange((status) => {
console.log(status.online, status.type);
});
online — true if connected, false if offline.type — Connection type: 'wifi', 'cellular', or 'none'.