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 + "%"); }); 電池充電電池事件