useBattery
A hook to monitor battery information
Loading...
Installation
npx shadcn@latest add @shadcnhooks/use-batteryAPI
export interface UseBatteryState {
isSupported: boolean
charging: boolean
chargingTime: number
dischargingTime: number
level: number
}
/**
* Monitor the current battery information using the Battery Status API.
*
* @returns Current battery state and support flag.
*/
export function useBattery(): UseBatteryStateCredits
Last updated on