indexedDB

グローバルの indexedDB は読み取り専用プロパティで、アプリケーションが indexed データベースの機能に非同期でアクセスするための機構を提供します。

IDBFactory オブジェクトです。

以下のコードでは、データベースを開くためのリクエストを非同期に作成し、データベースが開かれた後で、リクエストの onsuccess ハンドラーが呼び出されます。

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

ブラウザーの互換性

BCD tables only load in the browser

関連情報