getAllKeys()
方法在
IDBIndex
interface instantly retrieves the primary keys of all objects inside the index, setting them as the
result
of the request object.
var allKeysRequest = IDBIndex.getAllKeys(); var allKeysRequest = IDBIndex.getAllKeys(query); var allKeysRequest = IDBIndex.getAllKeys(query, count);
IDBKeyRange
identifying the keys to retrieve. If this value is null or missing, the browser will use an unbound key range.
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 the following types:
| 异常 | 描述 |
|---|---|
TransactionInactiveError
|
This
IDBIndex
's transaction is inactive.
|
InvalidStateError
|
IDBIndex
has been deleted or removed.
|
A
TypeError
exception is thrown if the
count
parameter is not between
0
and
2
32
-1
included.
var myIndex = objectStore.index('index');
var getAllKeysRequest = myIndex.getAllKeys();
getAllKeysRequest.onsuccess = function() {
console.log(getAllKeysRequest.result);
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
索引数据库 API 草案
The definition of 'getAll()' in that specification. |
推荐 | 初始定义。 |
|
索引数据库 API 草案
The definition of 'getAll()' in that specification. |
推荐 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getAllKeys
|
Chrome 48 | Edge ≤18 |
Firefox
44
Disabled
|
IE No | Opera 35 | Safari 10.1 | WebView Android 48 | Chrome Android 48 |
Firefox Android
44
Disabled
|
Opera Android 35 | Safari iOS 10.3 | Samsung Internet Android 5.0 |
完整支持
不支持
用户必须明确启用此特征。
IDBDatabase
IDBTransaction
IDBKeyRange
IDBObjectStore
IDBCursor
IDBIndex
count()
get()
getAll()
getAllKeys()
getKey()
openCursor()
openKeyCursor()
IDBCursor
IDBCursorSync
IDBCursorWithValue
IDBDatabase
IDBDatabaseException
IDBDatabaseSync
IDBEnvironment
IDBEnvironmentSync
IDBFactory
IDBFactorySync
IDBIndexSync
IDBKeyRange
IDBObjectStore
IDBObjectStoreSync
IDBOpenDBRequest
IDBRequest
IDBTransaction
IDBTransactionSync
IDBVersionChangeEvent
IDBVersionChangeRequest