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.

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

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
requestChrome Full support 76Edge Full support 79Firefox Full support 77IE No support NoOpera Full support 63Safari ? WebView Android Full support 76Chrome Android Full support 76Firefox Android No support NoOpera Android Full support 54Safari iOS ? Samsung Internet Android Full support 12.0

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

See also