From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/idbenvironment/index.html | 71 +++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 files/zh-cn/web/api/idbenvironment/index.html (limited to 'files/zh-cn/web/api/idbenvironment') diff --git a/files/zh-cn/web/api/idbenvironment/index.html b/files/zh-cn/web/api/idbenvironment/index.html new file mode 100644 index 0000000000..6eff07e146 --- /dev/null +++ b/files/zh-cn/web/api/idbenvironment/index.html @@ -0,0 +1,71 @@ +--- +title: IDBEnvironment +slug: Web/API/IDBEnvironment +translation_of: Web/API/IDBEnvironment +--- +

{{APIRef()}}

+ +
+

注意! : 对于 Firefox 52, the property defined in this mixin has been moved to the {{domxref("WindowOrWorkerGlobalScope")}} mixin, and other browsers will follow suit. Look to that page for up-to-date details.  IndexedDB API

+
+ +

 IndexedDB API提供的帮助类IDBEnvironment包含了一个indexedDB 属性, 这个属性可以比较方便的操作IndexedDB. 它是由{{domxref("window")}} 和{{domxref("Worker")}} 实现的最顶级 IndexedDB接口.

+ +

{{AvailableInWorkers}}

+ +

属性

+ +
+
{{domxref("IDBEnvironment.indexedDB")}} {{readonlyInline}}
+
该属性为应用程序提供了异步访问索引数据库(IndexedDB)的构件. 它包含一个 {{domxref("IDBFactory")}} 对象
+
+ +

示例

+ +

下述代码演示了如何创建一个异步打开数据库的请求, 当该请求的onsuccess 回调被执行时, 该数据库被打开.

+ +
var db;
+function openDB() {
+ var DBOpenRequest = window.indexedDB.open("toDoList");
+ DBOpenRequest.onsuccess = function(e) {
+   db = DBOpenRequest.result;
+ };
+}
+
+ +

规范

+ + + + + + + + + + + + + + +
规范状态说明
{{SpecName('IndexedDB', '#idl-def-IDBEnvironment', 'IDBEnvironment')}}{{Spec2('IndexedDB')}} 
+ +

浏览器兼容性

+ +
+ + +

{{Compat("api.IDBEnvironment")}}

+
+ +

参考

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