connection$

May 16, 2020 ยท View on GitHub

ReadonlyBehaviorSubject that changes in window.navigator.connection object. Is stubbed to also work on sever.

import { connection$ } from 'rx-use/lib/connection$';

connection$.getValue();
/*
{
  downlink?: number;
  downlinkMax?: number;
  effectiveType?: string;
  rtt?: number;
  type?: string;
}
*/

connection$.subscribe((connection) => {
  // ..
});