<div id="dischargingTime">(discharging time unknown)</div>BatteryManager: dischargingTime property / notebook
BatteryManager: dischargingTime property
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
navigator.getBattery().then((battery) => {
const time = battery.dischargingTime;
document.querySelector("#dischargingTime").textContent =
`Remaining time to fully discharge the battery: ${time}s`;
});