blob: e957315849093f04268bd5fe95addc4d92852a42 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
---
title: chargingchange
slug: Web/Events/chargingchange
tags:
- Event
- events
translation_of: Archive/Events/chargingchange
---
<p><code>chargingchange</code> 이벤트<code>는 </code><a href="/en-US/docs/DOM/window.navigator.battery">battery API</a> 의 <code>charging 속성이 변할때 발생 합니다.</code></p>
<h2 id="기본_정보">기본 정보</h2>
<dl>
<dt style="float: left; text-align: right; width: 120px;">Specification</dt>
<dd style="margin: 0 0 0 120px;"><a class="external" href="https://dvcs.w3.org/hg/dap/raw-file/tip/battery/Overview.html">Battery</a></dd>
<dt style="float: left; text-align: right; width: 120px;">Interface</dt>
<dd style="margin: 0 0 0 120px;">Event</dd>
<dt style="float: left; text-align: right; width: 120px;">Bubbles</dt>
<dd style="margin: 0 0 0 120px;">No</dd>
<dt style="float: left; text-align: right; width: 120px;">Cancelable</dt>
<dd style="margin: 0 0 0 120px;">No</dd>
<dt style="float: left; text-align: right; width: 120px;">Target</dt>
<dd style="margin: 0 0 0 120px;"><code>navigator.battery</code></dd>
<dt style="float: left; text-align: right; width: 120px;">Default Action</dt>
<dd style="margin: 0 0 0 120px;">None</dd>
</dl>
<h2 id="Properties" name="Properties">Properties</h2>
<p>The event callback doesn't receive any event objects, but properties can be read from the {{domxref("BatteryManager")}} object received from the {{domxref("navigator.getBattery")}} method.</p>
<table class="standard-table">
<tbody>
<tr>
<td class="header">Property</td>
<td class="header">Type</td>
<td class="header">Description</td>
</tr>
<tr>
<td>{{domxref("BatteryManager.charging")}}</td>
<td>boolean</td>
<td>The system's battery charging status. Returns <code>true</code> 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 <code>false</code> if the battery is discharging. Read only.</td>
</tr>
</tbody>
</table>
<h2 id="Example" name="Example">Example</h2>
<pre class="brush: js">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");
});
});
</pre>
<h2 id="관계_된_이벤트">관계 된 이벤트</h2>
<ul>
<li>{{Event("chargingtimechange")}}</li>
<li>{{Event("dischargingtimechange")}}</li>
<li>{{Event("levelchange")}}</li>
</ul>
|