IDBEnvironment
Important: As of Firefox 52, the property defined in this mixin has been moved to the WindowOrWorkerGlobalScope
mixin, and other browsers will follow suit. Look to that page for up-to-date details.
IndexedDB API の IDBEnvironment
インタフェースには、IndexedDB の機能へアクセスするための indexedDB
プロパティがあります。これは、window
と Worker
オブジェクトによって実装された、最上位の IndexedDB インタフェースです。
注:
この機能は Web Worker 内で利用可能です。プロパティ
IDBEnvironment.indexedDB
読取専用- インデックス化されたデータベースへ非同期的にアクセスするための機構を、アプリケーションへ提供する、
IDBFactory
オブジェクトです。
例
次のコードはデータベースを非同期に開くリクエストを生成しています。データベースが開かれた後、リクエストの onsuccess ハンドラーが呼ばれます。:
var db;
function openDB() {
var DBOpenRequest = window.indexedDB.open("toDoList");
DBOpenRequest.onsuccess = function(e) {
db = DBOpenRequest.result;
};
}
仕様
Specification | Status | Comment |
---|---|---|
Indexed Database API 2.0 IDBEnvironment の定義 |
勧告 |
ブラウザ実装状況
BCD tables only load in the browser
関連情報
- IndexedDBの使用
- トランザクションの開始:
IDBDatabase
- トランザクションの使用:
IDBTransaction
- キーの範囲の設定:
IDBKeyRange
- データの取り出しと変更:
IDBObjectStore
- カーソルの使用:
IDBCursor
- 参考例: To-do Notifications (view example live.)