BatteryManager: charging property
  
  
   The BatteryManager.charging property is a Boolean value indicating whether or not the device's battery is currently being charged. When its value changes, the chargingchange event is fired.
   If the battery is charging or the user agent is unable to report the battery status information, this value is true. Otherwise, it is false.
   
  Value
  
  Examples
  HTML
  
   
    
    <div id="charging">(charging state unknown)</div>
    
   
  JavaScript
  
   
    
    navigator.getBattery().then((battery) => {
  const charging = battery.charging;
  document.querySelector("#charging").textContent = charging;
});
    
   
   
   
  Specifications
  
  Browser compatibility
  
   
    
     
      
       |  | Desktop | Mobile | 
      
       |  | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | 
     
     
      
       | charging | 38 | 79 | 43–52 | No | 25 | No | 38 | 38 | 43–52 | 25 | No | 3.0 | 
     
    
    
   
  See also