Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

dischargingtimechange

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!

The dischargingtimechange event is fired when the dischargingTime attribute of the battery API has changed.

General info

Specification
Battery
Interface
Event
Bubbles
No
Cancelable
No
Target
BatteryManager
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.dischargingTime double (float) the remaining time in seconds until the system's battery is completely discharged and the system is about to be suspended. Returns positive infinity if the battery is charging, if the implementation is unable to report the remaining discharging time, or if there is no battery attached to the system. Read only.

Example

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

  console.log("Battery discharging time: " + battery.dischargingTime + " seconds");

  battery.addEventListener('dischargingtimechange', function() {
    console.log("Battery discharging time: " + battery.dischargingTime + " seconds");
  });

});

ドキュメントのタグと貢献者

タグ: 
 このページの貢献者: fscholz, franciov, teoli, Sheppy, ethertank, louisremi
 最終更新者: fscholz,