aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/progressevent/index.html
blob: cf50a3e4905f238aaffd359fd8d62f2f02c9b6bc (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
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>{{Compat("api.ProgressEvent")}}</p>

<h2 id="See_also">See also</h2>

<ul>
 <li>The {{domxref("Event")}} base interface.</li>
</ul>