BatteryManager.dischargingTime (배터리관리기 방전시간)

안씀
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

몇 초 단위로, 배터리가 완전히 방전될 때까지 남은 시간량을 가리킵니다.

반환되는 시간이 정확하더라도, 개인정보보호 정책 사유로 브라우저들이 더 큰 간격(대개 15분)으로 시간량을 반올림합니다.

Syntax

var time = battery.dischargingTime

반환되는 중에, timeBatteryManager object(객체)인 battery 가 완전히 방전되고 시스템이 중단되는 몇 초 뒤에 남게 되는 시간입니다.  배터리가 현재 방전되기보다 충전되거나 시스템이 남은 방전 시간을 보고할 수 없다면, 이 값은 무한 값입니다.

예제

HTML 콘텐츠

<div id="dischargingTime">(discharging time unknown)</div>

자바언어 콘텐츠

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

    var time = battery.dischargingTime;

    document.querySelector('#dischargingTime').textContent = battery.dischargingTime;
});

설명서

사양 (설명) 상태 (설명) 비고
Battery Status API Candidate Recommendation 최초 정의

브라우저 호환성

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
dischargingTime
Deprecated
Chrome Full support 38Edge No support NoFirefox No support 16 — 52
No support 16 — 52
No support 10 — 16
Prefixed
Prefixed Implemented with the vendor prefix: moz
Full support 52
Notes Disabled
Notes Disabled by default in Firefox 10, but can be enabled setting the preference dom.battery.enabled to true. Starting with Firefox 11, mozBattery is enabled by default. The Battery API is currently supported on Android, Windows, and Linux with UPower installed. Support for MacOS is available starting with Firefox 18. Firefox also provide support for the deprecated navigator.battery.
Disabled From version 52: this feature is behind the dom.battery.enabled preference. To change preferences in Firefox, visit about:config.
Full support 52
Notes
Notes From this version onwards, the Battery Status API is only available in chrome/privileged code.
IE No support NoOpera Full support 25Safari No support NoWebView Android Full support 40Chrome Android Full support 38
Notes
Full support 38
Notes
Notes Values for BatteryManager.chargingTime and BatteryManager.dischargingTime are always equal to Infinity.
Firefox Android No support 10 — 16
Prefixed
No support 10 — 16
Prefixed
Prefixed Implemented with the vendor prefix: moz
No support 16 — 52
Notes Disabled
Notes Disabled by default in Firefox 10.0, but can be enabled setting the preference dom.battery.enabled to true. Starting with Firefox 11.0, mozBattery is enabled by default. The Battery API is currently supported on Android, Windows, and Linux with UPower installed. Support for MacOS is available starting with Gecko 18.0 (Firefox 18.0 / Thunderbird 18.0 / SeaMonkey 2.15). Firefox also provide support for the deprecated navigator.battery.
Disabled From version 16 until version 52 (exclusive): this feature is behind the dom.battery.enabled preference. To change preferences in Firefox, visit about:config.
Full support 52
Notes
Notes From this version onwards, the Battery Status API is only available in chrome/privileged code.
Opera Android Full support 25Safari iOS No support ? — ?Samsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
Deprecated. Not for use in new websites.
Deprecated. Not for use in new websites.
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

같이 보세요