The request
read-only property of the IDBCursor
interface returns the IDBRequest
used to obtain the cursor.
Note: This feature is available in Web Workers.
Syntax
var request = cursor.request;
Value
An IDBRequest
object instance.
Examples
When you open a cursor, the request
property is then available on that cursor object, to tell you what request object the cursor originated from. For example:
function displayData() { list.innerHTML = ''; var transaction = db.transaction(['rushAlbumList'], 'readonly'); var objectStore = transaction.objectStore('rushAlbumList'); var request = objectStore.openCursor(); request.onsuccess = function(event) { var cursor = event.target.result; if(cursor) { var listItem = document.createElement('li'); listItem.innerHTML = '<strong>' + cursor.value.albumTitle + '</strong>, ' + cursor.value.year; list.appendChild(listItem); console.log(cursor.request); cursor.continue(); } else { console.log('Entries all displayed.'); } }; };
Specification
Specification | Status | Comment |
---|---|---|
Indexed Database API Draft The definition of 'request' in that specification. |
Recommendation | Initial definition. |
Browser compatibility
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.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
request | Chrome Full support 76 | Edge Full support 79 | Firefox Full support 77 | IE No support No | Opera Full support 63 | Safari ? | WebView Android Full support 76 | Chrome Android Full support 76 | Firefox Android No support No | Opera Android Full support 54 | Safari iOS ? | Samsung Internet Android Full support 12.0 |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
See also
- Using IndexedDB
- Starting transactions:
IDBDatabase
- Using transactions:
IDBTransaction
- Setting a range of keys:
IDBKeyRange
- Retrieving and making changes to your data:
IDBObjectStore
- Using cursors:
IDBCursor
- Reference example: To-do Notifications (view example live.)