chargingchange

chargingchange 이벤트battery APIcharging 속성이 변할때 발생 합니다.

기본 정보

Specification
Battery
Interface
Event
Bubbles
No
Cancelable
No
Target
navigator.battery
Default Action
None

Properties

The event callback doesn't receive any event objects, but properties can be read from the BatteryManager object received from the navigator.getBattery method.

Property Type Description
BatteryManager.charging boolean The system's battery charging status. Returns true if the battery is charging, if the state of the system's battery is not determinable, or if no battery is attached to the system. Returns false if the battery is discharging. Read only.

Example

navigator.getBattery().then(function(battery) {

  console.log("Battery charging? " + battery.charging ? "Yes" : "No");

  battery.addEventListener('chargingchange', function() {
    console.log("Battery charging? " + battery.charging ? "Yes" : "No");
  });

});

관계 된 이벤트

문서 태그 및 공헌자

태그: 
 이 페이지의 공헌자: fscholz, oohii
 최종 변경: fscholz,