You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: usehooks.com/src/content/hooks/useBattery.mdx
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
name: useBattery
3
3
rank: 32
4
-
tagline: Track the battery status of a user's device with useBattery.
4
+
tagline: Track the battery status of a user’s device with useBattery.
5
5
sandboxId: usebattery-o8js1p
6
6
previewHeight: 320px
7
7
relatedHooks:
@@ -15,7 +15,7 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
15
15
16
16
<HookDescriptionname={frontmatter.name}>
17
17
The useBattery hook is useful for accessing and monitoring the battery status
18
-
of the user's device in a React application. By using this hook, you can
18
+
of the user’s device in a React application. By using this hook, you can
19
19
easily retrieve information such as the battery level, charging status, and
20
20
estimated charging and discharging times. It provides a state object that
21
21
includes properties like supported, loading, level, charging, chargingTime,
@@ -30,12 +30,12 @@ import StaticCodeContainer from "../../components/StaticCodeContainer.astro";
30
30
<divclass="table-container">
31
31
| Name | Type | Description |
32
32
| ---------------- | ------- | ----------- |
33
-
| supported | boolean | Indicates whether the Battery Status API is supported in the user's browser. |
33
+
| supported | boolean | Indicates whether the Battery Status API is supported in the user’s browser. |
34
34
| loading | boolean | Indicates if the battery information is still loading. |
35
-
| level | number | Represents the level of the system's battery. 0.0 means that the system's battery is completely discharged, and 1.0 means the battery is completely charged. |
36
-
| charging | boolean | Represents whether the system's battery is charging. `true` means the battery is charging, `false` means it's not. |
37
-
| chargingTime | number | Represents the time remaining in seconds until the system's battery is fully charged. |
38
-
| dischargingTime | number | Represents the time remaining in seconds until the system's battery is completely discharged and the system is about to be suspended. |
35
+
| level | number | Represents the level of the system’s battery. 0.0 means that the system’s battery is completely discharged, and 1.0 means the battery is completely charged. |
36
+
| charging | boolean | Represents whether the system’s battery is charging. `true` means the battery is charging, `false` means it’s not. |
37
+
| chargingTime | number | Represents the time remaining in seconds until the system’s battery is fully charged. |
38
+
| dischargingTime | number | Represents the time remaining in seconds until the system’s battery is completely discharged and the system is about to be suspended. |
| threshold | number | 1 | Either a single number or an array of numbers between 0 and 1, indicating at what percentage of the target's visibility the observer's callback should be executed. |
32
+
| threshold | number | 1 | Either a single number or an array of numbers between 0 and 1, indicating at what percentage of the target’s visibility the observer’s callback should be executed. |
33
33
| root | element | null | The Element that is used as the viewport for checking visibility of the target. Defaults to the browser viewport if not specified or if null. |
34
-
| rootMargin | string | "0%" | Margin around the root. Can have values similar to the CSS margin property. The values can be percentages. This set of values serves to grow or shrink each side of the root element's bounding box before computing intersections. Defaults to all zeros. |
34
+
| rootMargin | string | "0%" | Margin around the root. Can have values similar to the CSS margin property. The values can be percentages. This set of values serves to grow or shrink each side of the root element’s bounding box before computing intersections. Defaults to all zeros. |
0 commit comments