UseGetBattery
katanakit-js / useGetBattery
Function: useGetBattery()
Section titled “Function: useGetBattery()”function useGetBattery(): Promise<BatteryManager | null>;Defined in: infrastructure/sensors/sensors.service.ts:315
Gets the device battery status.
Returns
Section titled “Returns”Promise<BatteryManager | null>
A BatteryManager object or null if the API is unavailable.
Example
Section titled “Example”const battery = await useGetBattery();if (battery) { console.log(`${Math.round(battery.level * 100)}%`);}