StackOverflow 文档 JavaScript 教程 电池状态 API 获得当前的电池电量 获得当前的电池电量 Created: November-22, 2018 // Get the battery API navigator.getBattery().then(function(battery) { // Battery level is between 0 and 1, so we multiply it by 100 to get in percents console.log("Battery level: " + battery.level * 100 + "%"); }); 电池充电电池事件