/ src / components / demo / enhanced_fp / navigator_connection_downlink_max.tsx
navigator_connection_downlink_max.tsx
 1  import Code from "../../Code";
 2  import Output from "../../Output";
 3  
 4  const NavigatorConnectionDownlinkMaxDemo = () => {
 5    return (
 6      <div>
 7        <Code
 8          snippet={`
 9  navigator.connection && navigator.connection.downlinkMax
10    ? typeof navigator.connection.downlinkMax === "number" && navigator.connection.downlinkMax !== Infinity
11      ? navigator.connection.downlinkMax
12      : -1
13    : null;
14          `.trim()}
15        />
16  
17        <Output
18          generator={() => {
19            // @ts-expect-error
20            return navigator.connection && navigator.connection.downlinkMax
21              ? // @ts-expect-error
22                typeof navigator.connection.downlinkMax === "number" &&
23                // @ts-expect-error
24                navigator.connection.downlinkMax !== Infinity
25                ? // @ts-expect-error
26                  navigator.connection.downlinkMax
27                : -1
28              : null;
29          }}
30        />
31      </div>
32    );
33  };
34  
35  export default NavigatorConnectionDownlinkMaxDemo;