ProgressEvent

The ProgressEvent インターフェースは (XMLHttpRequest、または <img>, <audio>, <video>, <style> ,<link>のような基本的なリソースのロードなどの)のようなHTTPリクエストイベントの基本的なプロセスの進捗の進み具合を表示します。

コンストラクタ

ProgressEvent() (en-US)
Creates a ProgressEvent event with the given parameters.

Properties

Also inherits properties from its parent Event.

ProgressEvent.lengthComputable (en-US) 読取専用
Is a 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.
ProgressEvent.loaded (en-US) 読取専用
Is an unsigned long long representing the amount of work already performed by the underlying process. The ratio of work done can be calculated with the property and ProgressEvent.total. When downloading a resource using HTTP, this only represent the part of the content itself, not headers and other overhead.
ProgressEvent.total (en-US) 読取専用
Is an unsigned long long 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.

メソッド

Also inherits methods from its parent Event.

ProgressEvent.initProgressEvent() (en-US)
Initializes a ProgressEvent created using the deprecated Document.createEvent("ProgressEvent") method.

The following example adds a ProgressEvent to a new XMLHTTPRequest and uses it to display the status of the request.

  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()

仕様書

Specification Status Comment
Unknown
ProgressEvent の定義
不明 Initial definition.

ブラウザ互換性

BCD tables only load in the browser

See also

  • The Event base interface.