电池充电
// Get the battery API
navigator.getBattery().then(function(battery) {
if (battery.charging) {
console.log("Battery is charging");
} else {
console.log("Battery is discharging");
}
});
// Get the battery API
navigator.getBattery().then(function(battery) {
if (battery.charging) {
console.log("Battery is charging");
} else {
console.log("Battery is discharging");
}
});