IDBKeyRange: includes() メソッド
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.
メモ: この機能はウェブワーカー内で利用可能です。
includes()
は IDBKeyRange
インターフェイスのメソッドで、指定のキーがこのキーの範囲に含まれるかを表す論理値を返します。
構文
js
includes(key)
引数
key
-
キーの範囲に含まれるかをチェックするキーです。任意の型を使用可能です。
返値
論理値です。
例外
DataError
DOMException
-
指定されたキーが有効なキーでないとき投げられます。
例
js
const keyRangeValue = IDBKeyRange.bound("A", "K", false, false);
keyRangeValue.includes("F");
// true を返します
keyRangeValue.includes("W");
// false を返します
仕様書
Specification |
---|
Indexed Database API 3.0 # ref-for-dom-idbkeyrange-includes① |
ブラウザーの互換性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
includes |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
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 (動く例を見る)