Plugin EcosystemSystem & OS
Device
Access hardware and operating system details.
The Device plugin provides rich telemetry about the user's hardware, operating system, and current device state. This is highly useful for analytics, feature flagging, and targeted debugging.
Installation
npm install @easycord/deviceAPI Reference
getInfo()
Retrieves comprehensive information about the device.
import { Device } from '@easycord/device';
import { useEffect, useState } from 'react';
export function DeviceDiagnostics() {
const [deviceInfo, setDeviceInfo] = useState<any>(null);
useEffect(() => {
Device.getInfo().then(setDeviceInfo);
}, []);
if (!deviceInfo) return <div>Loading diagnostics...</div>;
return (
<dl>
<dt>OS Name</dt>
<dd>{deviceInfo.osName}</dd>
<dt>OS Version</dt>
<dd>{deviceInfo.osVersion}</dd>
<dt>Model</dt>
<dd>{deviceInfo.model}</dd>
</dl>
);
}getBatteryLevel()
Returns the current battery level as a float between 0.0 and 1.0.
const level = await Device.getBatteryLevel();
if (level < 0.2) {
console.warn('Battery is critically low!');
}