getAll()
方法在
IDBObjectStore
interface returns an
IDBRequest
object containing 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 either call
openCursor()
method with the same key. That method provides a cursor if the record exists, and no cursor if it does not.
count()
method with the same key, which will return 1 if the row exists and 0 if it doesn't.
var request = objectStore.getAll(); var request = objectStore.getAll(query); var request = objectStore.getAll(query, count);
IDBKeyRange
to be queried. If nothing is passed, this will default to a key range that selects all the records in this object store.
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.
|
A
TypeError
exception is thrown if the
count
parameter is not between
0
and
2
32
-1
included.
| 规范 | 状态 | 注释 |
|---|---|---|
|
索引数据库 API 草案
The definition of 'getAll()' in that specification. |
推荐 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getAll
|
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