import { trackNetwork, isConstrainedNetwork } from "@milliman/dd-ux-utils/env/network";
const stop = trackNetwork({
reportChanges: true,
changeSampleRate: 20,
constrained: { maxDownlinkMbps: 1, effectiveTypes: ["2g", "slow-2g", "3g"] },
});
// Later, e.g., to adjust image quality:
if (isConstrainedNetwork()) loadLowResImages();
// On teardown:
stop();
Start tracking network conditions. Safe to call multiple times; returns an uninstaller that removes listeners.
navigator.connection
(when available) and theonline
/offline
window events.