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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
|
---
title: ProgressEvent
slug: Web/API/ProgressEvent
translation_of: Web/API/ProgressEvent
---
<p>{{APIRef("DOM Events")}}</p>
<p>The <strong><code>ProgressEvent</code></strong> インターフェースは (<code>XMLHttpRequest</code>、または {{HTMLElement("img")}}, {{HTMLElement("audio")}}, {{HTMLElement("video")}}, {{HTMLElement("style")}} ,{{HTMLElement("link")}}のような基本的なリソースのロードなどの)のようなHTTPリクエストイベントの基本的なプロセスの進捗の進み具合を表示します。</p>
<h2 id="コンストラクタ">コンストラクタ</h2>
<dl>
<dt>{{domxref("ProgressEvent.ProgressEvent", "ProgressEvent()")}}</dt>
<dd>Creates a <code>ProgressEvent</code> event with the given parameters.</dd>
</dl>
<h2 id="Properties">Properties</h2>
<p><em>Also inherits properties from its parent {{domxref("Event")}}</em>.</p>
<dl>
<dt>{{domxref("ProgressEvent.lengthComputable")}} {{readonlyInline}}</dt>
<dd>Is a {{domxref("Boolean")}} flag indicating if the total work to be done, and the amount of work already done, by the underlying process is calculable. In other words, it tells if the progress is measurable or not.</dd>
<dt>{{domxref("ProgressEvent.loaded")}} {{readonlyInline}}</dt>
<dd>Is an <code>unsigned long long</code> representing the amount of work already performed by the underlying process. The ratio of work done can be calculated with the property and <code>ProgressEvent.total</code>. When downloading a resource using HTTP, this only represent the part of the content itself, not headers and other overhead.</dd>
<dt>{{domxref("ProgressEvent.total")}} {{readonlyInline}}</dt>
<dd>Is an <code>unsigned long long</code> representing the total amount of work that the underlying process is in the progress of performing. When downloading a resource using HTTP, this only represent the content itself, not headers and other overhead.</dd>
</dl>
<h2 id="メソッド">メソッド</h2>
<dl>
</dl>
<p><em>Also inherits methods <em>from its parent {{domxref("Event")}}.</em></em></p>
<dl>
<dt>{{domxref("ProgressEvent.initProgressEvent()")}} {{deprecated_inline}}{{non-Standard_inline}}</dt>
<dd>Initializes a <code>ProgressEvent</code> created using the deprecated {{domxref("Document.createEvent()", "Document.createEvent(\"ProgressEvent\")")}} method.</dd>
</dl>
<h2 id="例">例</h2>
<p>The following example adds a <code>ProgressEvent</code> to a new {{domxref("XMLHTTPRequest")}} and uses it to display the status of the request.</p>
<pre class="brush: js"> var progressBar = document.getElementById("p"),
client = new XMLHttpRequest()
client.open("GET", "magical-unicorns")
client.onprogress = function(pe) {
if(pe.lengthComputable) {
progressBar.max = pe.total
progressBar.value = pe.loaded
}
}
client.onloadend = function(pe) {
progressBar.value = pe.loaded
}
client.send()</pre>
<h2 id="仕様書">仕様書</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('Progress Events', '#interface-progressevent', 'ProgressEvent')}}</td>
<td>{{Spec2('Progress Events')}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="ブラウザ互換性">ブラウザ互換性</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>Basic support</td>
<td>1.0</td>
<td>{{CompatGeckoDesktop("1.9.1")}}</td>
<td>10.0</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatVersionUnknown}}</td>
</tr>
<tr>
<td><code>initProgressEvent()</code> {{non-standard_inline}}{{deprecated_inline}}</td>
<td>{{CompatNo}}<sup>[1]</sup></td>
<td>{{CompatNo}}<sup>[2]</sup></td>
<td>10.0</td>
<td>{{CompatNo}}<sup>[4]</sup></td>
<td>{{CompatNo}}<sup>[3]</sup></td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Android Webview</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
<th>Chrome for Android</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatGeckoMobile("1.9.1")}}</td>
<td>10.0</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatVersionUnknown}}</td>
</tr>
<tr>
<td><code>initProgressEvent()</code> {{non-standard_inline}}{{deprecated_inline}}</td>
<td>{{CompatNo}}<sup>[3]</sup></td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}<sup>[2]</sup></td>
<td>10.0</td>
<td>{{CompatNo}}<sup>[4]</sup></td>
<td>{{CompatNo}}<sup>[3]</sup></td>
<td>{{CompatNo}}</td>
</tr>
</tbody>
</table>
</div>
<p>[1] This feature was implemented in Chrome 1.0, but removed in Chrome 17.0.</p>
<p>[2] This feature was implemented in Gecko 1.9.1 {{geckoRelease("1.9.1")}}, but removed in Gecko 22 {{geckoRelease("22")}}.</p>
<p>[3] This feature was removed at some point.</p>
<p>[4] This feature was removed in Opera 15.0.</p>
<h2 id="See_also">See also</h2>
<ul>
<li>The {{domxref("Event")}} base interface.</li>
</ul>
|