IDBCursor.request

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 

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.textContent = '';
  const transaction = db.transaction(['rushAlbumList'], 'readonly');
  const objectStore = transaction.objectStore('rushAlbumList');

  const request = objectStore.openCursor();

  request.onsuccess = function(event) {
    const cursor = event.target.result;
      if(cursor) {
        const 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.');
      }
  };
};


Specifications

Specification
Indexed Database API 3.0 # ref-for-dom-idbcursor-request①

Browser compatibility




Desktop
Mobile



Chrome
Edge
Firefox
Internet Explorer
Opera
Safari
WebView Android
Chrome Android
Firefox for Android
Opera Android
Safari on IOS
Samsung Internet



request
76
79
77
No
63
15
76
76
No
54
15
12.0


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.) 


Found a problem with this page?

Edit on GitHub
Source on GitHub
Report a problem with this content on GitHub
Want to fix the problem yourself? See our Contribution guide.


Last modified: Mar 29, 2022, by MDN contributors


    
{'path': 'public/docs/dom/idbcursor/request.html', 'source': 'DevDocs.IO'}