Fixed crash on mobile by battery indicator
This commit is contained in:
parent
1499e4f178
commit
1e993fb632
1 changed files with 2 additions and 2 deletions
|
|
@ -10,7 +10,7 @@ export function Battery() {
|
|||
// const [dischargingTime, setDischargingTime] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
navigator.getBattery().then((battery) => {
|
||||
navigator.getBattery?.()?.then((battery) => {
|
||||
const updateIsCharging = () => {
|
||||
setIsCharging(battery.charging);
|
||||
};
|
||||
|
|
@ -44,7 +44,7 @@ export function Battery() {
|
|||
// battery.removeEventListener("dischargingtimechange", updateDischargingTime);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, []);
|
||||
|
||||
let icon = faBatteryFull;
|
||||
if (percentage < 25) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue