WorkerGlobalScope: indexedDB プロパティ
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2021.
indexedDB
は WorkerGlobalScope
インターフェイスの読み取り専用プロパティで、アプリケーションが索引付きデータベースの機能に非同期でアクセスするための機構を提供します。
値
IDBFactory
オブジェクトです。
例
以下のコードでは、データベースを開くためのリクエストを非同期に作成し、データベースが開かれた後で、リクエストの onsuccess
ハンドラーが呼び出されます。
js
let db;
function openDB() {
const DBOpenRequest = self.indexedDB.open("toDoList");
DBOpenRequest.onsuccess = (e) => {
db = DBOpenRequest.result;
};
}
仕様書
Specification |
---|
Indexed Database API 3.0 # dom-windoworworkerglobalscope-indexeddb |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
indexedDB | |||||||||||||
Available in workers |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- Requires a vendor prefix or different name for use.
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
関連情報
- IndexedDB の使用
- トランザクションの開始:
IDBDatabase
- トランザクションの使用:
IDBTransaction
- キーの範囲設定:
IDBKeyRange
- データの取得と変更:
IDBObjectStore
- カーソルの使用:
IDBCursor
- 参照例: To-do Notifications(例をライブで参照)