From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../zh-cn/archive/b2g_os/api/domrequest/index.html | 139 +++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 files/zh-cn/archive/b2g_os/api/domrequest/index.html (limited to 'files/zh-cn/archive/b2g_os/api/domrequest') diff --git a/files/zh-cn/archive/b2g_os/api/domrequest/index.html b/files/zh-cn/archive/b2g_os/api/domrequest/index.html new file mode 100644 index 0000000000..0f4502fac7 --- /dev/null +++ b/files/zh-cn/archive/b2g_os/api/domrequest/index.html @@ -0,0 +1,139 @@ +--- +title: DOMRequest +slug: Archive/B2G_OS/API/DOMRequest +tags: + - API + - DOM + - 回调 +translation_of: Archive/B2G_OS/API/DOMRequest +--- +
+ +

DOMRequest对象表示正在进行的操作。 它提供在操作完成时调用的回调,以及对操作结果的引用。 启动一个进行中的操作,DOM方法会返回一个DOMRequest对象,您可以使用该对象来监视该操作的进度。

+ +

Note: 此特性在 Web Worker 中可用。

+ +

属性

+ +
+
DOMRequest.onsuccess
+
当由DOMRequest表示的操作完成时调用的回调处理程序。
+
DOMRequest.onerror
+
当处理操作发生错误时调用的回调处理程序。
+
DOMRequest.readyState
+
表示操作是否已完成运行的字符串。 其值为“done”或“pending”。
+
DOMRequest.result
+
操作的结果。
+
DOMRequest.error
+
错误信息(如果有)。
+
+ +

方法

+ +

无.

+ +

例子

+ +

使用DOMRequest对象的onsuccess,onerror,result和error属性的一个示例。

+ +
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);
+};
+ +

规范

+ +

目前不是任何规范的一部分。

+ +

浏览器支持

+ +

We're converting our compatibility data into a machine-readable JSON format. + This compatibility table still uses the old format, + because we haven't yet converted the data it contains. + Find out how you can help!

+ +
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support?13.0 (13.0)???
Available in workers?41.0 (41.0)???
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureAndroidChrome for AndroidFirefox Mobile (Gecko)IE MobileOpera MobileSafari Mobile
Basic support??13.0 (13.0)???
Available in workers??41.0 (41.0)???
+
+ +

另见

+ + -- cgit v1.2.3-54-g00ecf