BatteryManager.charging
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
현재 배터리가 충전중인지를 나타내는 Boolean 값 입니다.
문법
js
var charging = battery.charging;
charging
변수는 배터리가 충전 중인지의 여부를 가져옵니다. 충전중일경우 true
. 이외에는 false
를 가리킵니다.
예제
HTML Content
html
<div id="charging">(charging state unknown)</div>
JavaScript Content
js
navigator.getBattery().then(function (battery) {
var charging = battery.charging;
document.querySelector("#charging").textContent = charging;
});
명세
Specification |
---|
Battery Status API # dom-batterymanager-charging |
브라우저 호환성
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
charging |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.