indexedDB
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
グローバルの indexedDB は読み取り専用プロパティで、アプリケーションが indexed データベースの機能に非同期でアクセスするための機構を提供します。
値
IDBFactory オブジェクトです。
例
以下のコードでは、データベースを開くためのリクエストを非同期に作成し、データベースが開かれた後で、リクエストの onsuccess ハンドラーが呼び出されます。
js
let db;
function openDB() {
const DBOpenRequest = window.indexedDB.open("toDoList");
DBOpenRequest.onsuccess = (e) => {
db = DBOpenRequest.result;
};
}
仕様書
| Specification |
|---|
| Indexed Database API 3.0> # dom-windoworworkerglobalscope-indexeddb> |
ブラウザーの互換性
Loading…
関連情報
- IndexedDB の使用
- トランザクションの開始:
IDBDatabase - トランザクションの使用:
IDBTransaction - キーの範囲設定:
IDBKeyRange - データの取得と変更:
IDBObjectStore - カーソルの使用:
IDBCursor - 参照例: To-do Notifications(例をライブで参照)