getAllKeys()
方法在
IDBObjectStore
interface returns an
IDBRequest
object retrieves record keys for all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.
If a value is successfully found, then a structured clone of it is created and set as the result of the request object.
This method produces the same result for:
To tell these situations apart, you need to call the
openCursor()
method with the same key. That method provides a cursor if the record exists, and no cursor if it does not.
var request = objectStore.getAllKeys(); var request = objectStore.getAllKeys(query); var request = objectStore.getAllKeys(query, count);
IDBKeyRange
.
0
or greater than
2
32
-1
a
TypeError
exception will be thrown.
IDBRequest
object on which subsequent events related to this operation are fired.
此方法可能引发
DOMException
of one of the following types:
| 异常 | 描述 |
|---|---|
TransactionInactiveError
|
This
IDBObjectStore
's transaction is inactive.
|
DataError
|
The key or key range provided contains an invalid key or is null. |
InvalidStateError
|
IDBObjectStore
has been deleted or removed.
|
| 规范 | 状态 | 注释 |
|---|---|---|
|
索引数据库 API 草案
The definition of 'getAllKeys()' in that specification. |
推荐 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getAllKeys
|
Chrome 48 | Edge ≤79 | Firefox 44 | IE ? | Opera 35 | Safari 10.1 | WebView Android 48 | Chrome Android 48 | Firefox Android 48 | Opera Android 35 | Safari iOS 10.3 | Samsung Internet Android 5.0 |
完整支持
兼容性未知
IDBDatabase
IDBTransaction
IDBKeyRange
IDBObjectStore
IDBCursor
IDBObjectStore
IDBCursor
IDBCursorSync
IDBCursorWithValue
IDBDatabase
IDBDatabaseException
IDBDatabaseSync
IDBEnvironment
IDBEnvironmentSync
IDBFactory
IDBFactorySync
IDBIndex
IDBIndexSync
IDBKeyRange
IDBObjectStoreSync
IDBOpenDBRequest
IDBRequest
IDBTransaction
IDBTransactionSync
IDBVersionChangeEvent
IDBVersionChangeRequest