mirror of
https://github.com/codex-storage/codex-marketplace-ui.git
synced 2025-02-22 12:48:32 +00:00
Add device info
This commit is contained in:
parent
225b1ee205
commit
e1fc8f8f27
@ -4,34 +4,46 @@ import { ErrorPlaceholder } from "../../components/ErrorPlaceholder/ErrorPlaceho
|
||||
import { useEffect } from "react";
|
||||
|
||||
const Device = () => {
|
||||
useEffect(() => {
|
||||
const request = new XMLHttpRequest();
|
||||
request.onreadystatechange = function () {
|
||||
if (request.readyState === XMLHttpRequest.DONE) {
|
||||
//
|
||||
// The following headers may often be similar
|
||||
// to those of the original page request...
|
||||
//
|
||||
console.info(request.getAllResponseHeaders());
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Re-request the same page (document.location)
|
||||
// We hope to get the same or similar response headers to those which
|
||||
// came with the current page, but we have no guarantee.
|
||||
// Since we are only after the headers, a HEAD request may be sufficient.
|
||||
//
|
||||
request.open("HEAD", document.location, true);
|
||||
request.send(null);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<ErrorBoundary
|
||||
fallback={({ error }) => (
|
||||
<ErrorPlaceholder error={error} subtitle="Cannot retrieve the data." />
|
||||
)}>
|
||||
couc
|
||||
<p> Platform : {navigator.platform}</p>
|
||||
<br></br>
|
||||
<p> Downlink : {(navigator as any).connection.downlink}</p>
|
||||
<small>
|
||||
The downlink attribute represents the effective bandwidth estimate in
|
||||
megabits per second, rounded to nearest multiple of 25 kilobits per
|
||||
second, and is based on recently observed application layer throughput
|
||||
across recently active connections, excluding connections made to
|
||||
private address space [RFC1918]. In absence of recent bandwidth
|
||||
measurement data, the attribute value is determined by the properties of
|
||||
the underlying connection technology. MDN
|
||||
</small>
|
||||
<br></br>
|
||||
<p> EffectiveType : {(navigator as any).connection.effectiveType}</p>
|
||||
<small>
|
||||
The effectiveType attribute, when getting, returns the effective
|
||||
connection type that is determined using a combination of recently
|
||||
observed rtt and downlink values.
|
||||
</small>
|
||||
<br></br>
|
||||
|
||||
<p> Rtt : {(navigator as any).connection.rtt}</p>
|
||||
<small>
|
||||
The rtt attribute represents the effective round-trip time estimate in
|
||||
milliseconds, rounded to nearest multiple of 25 milliseconds, and is
|
||||
based on recently observed application-layer RTT measurements across
|
||||
recently active connections, excluding connections made to private
|
||||
address space [RFC1918]. In absence of recent RTT measurement data, the
|
||||
attribute value is determined by the properties of the underlying
|
||||
connection technology.
|
||||
</small>
|
||||
<br></br>
|
||||
|
||||
<p> SaveData : {(navigator as any).connection.saveData.toString()}</p>
|
||||
<small></small>
|
||||
</ErrorBoundary>
|
||||
);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user