Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 1.03 KB

story.mdx

File metadata and controls

45 lines (35 loc) · 1.03 KB

import { Canvas, Meta, Story } from '@storybook/addon-docs'; import { Example } from './example.stories'; import { ImportPath } from '../../docs/ImportPath';

useBattery

Hook that tracks battery state.

  • Automatically updates on battery state changes.
  • SSR compatible. (Properties return undefined on server.)

Example

Reference

export type BatteryState = {
	/**
	 * @desc {true} if the battery is charging, {false} otherwise.
	 */
	readonly charging: boolean | undefined;
	/**
	 * @desc The time remaining in seconds until the system's battery is fully charged.
	 */
	readonly chargingTime: number | undefined;
	/**
	 * @desc The time remaining in seconds until the system's battery is fully discharged.
	 */
	readonly dischargingTime: number | undefined;
	/**
	 * @desc The battery level of the system as a number between 0 and 1.
	 */
	readonly level: number | undefined;
};

Importing