A DOMRequest object represents an ongoing operation. It provides callbacks that are called when the operation completes, as well as a reference to the operation's result. A DOM method that initiates an ongoing operation may return a DOMRequest object that you can use to monitor the progress of that operation.

注意: 此特征可用于 Web 工作者 .

特性

DOMRequest.onsuccess
A callback handler called when the operation represented by the DOMRequest is completed.
DOMRequest.onerror

A callback handler that gets called when an error occurs while processing the operation.

DOMRequest.readyState
A string indicating whether or not the operation is finished running. Its value is either "done" or "pending".
DOMRequest.result

The operation's result.

DOMRequest.error

Error information, if any.

方法

None.

范例

An example of using the onsuccess , onerror , result ,和 error properties of a DOMRequest 对象。

var pending = navigator.mozApps.install(manifestUrl);
pending.onsuccess = function () {
  // Save the App object that is returned
  var appRecord = this.result;
  alert('Installation successful!');
};
pending.onerror = function () {
  // Display the name of the error
  alert('Install failed, error: ' + this.error.name);
};
						

规范

Not currently part of any specification.

浏览器兼容性

Supported in Firefox 13.
Available in workers in Firefox 41.

另请参阅

元数据

  • 最后修改: