• Skip to main content
  • Select language
  • Skip to search
MDN Web Docs
  • Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • HTTP
    • APIs / DOM
    • WebExtensions
    • MathML
  • References & Guides
    • Learn web development
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • Game development
    • ...more docs
B2G OS
  1. MDN
  2. Archive of obsolete content
  3. B2G OS
  4. B2G OS APIs
  5. DOMCursor

DOMCursor

In This Article
  1. Summary
  2. Properties
  3. Methods
  4. Example
  5. Specification
  6. Browser compatibility
  7. See also
 

Summary

A DOMCursor object represents an ongoing operation over a list of results. It is an enhanced DOMRequest that allows to iterate through a list of results asynchronously. Each time its continue() method is called, the DOMCursor tries to reach the next result in the list and calls its result's success or error accordingly.

Note: This feature is available in Web Workers.

Properties

DOMCursor.done
A boolean indicating if the cursor has reached the last result.

Methods

DOMCursor.continue()
Moves the cursor to the next result.

Example

var sdcard = navigator.getDeviceStorage('sdcard');
var cursor = sdcard.enumerate();
cursor.onsuccess = function () {
  console.log("File found: " + this.result.name);
  // Once we found a file we check if there is other results
  if (!this.done) {
    // Then we move to the next result, which call the
    // cursor success with the next file as result.
    this.continue();
  }
}

Specification

Not currently part of any specification.

Browser compatibility

  • Desktop
  • Mobile
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support ? 21.0 (21.0) ? ? ?
Available in workers ? 41.0 (41.0) ? ? ?
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support ? ? 21.0 (21.0) ? ? ?
Available in workers ? ? 41.0 (41.0) ? ? ?

See also

  • DOMRequest

Document Tags and Contributors

Tags: 
  • API
  • DOM
  • Interface
  • Non-standard
  • Reference
 Contributors to this page: chrisdavidmills, fscholz, teoli, arief.rahman.hakim.s.st.pi, MHasan, kscarfone, Jeremie
 Last updated by: chrisdavidmills, Feb 27, 2017, 2:08:12 AM
See also
  1. Archive
  2. Related pages for DOM (Non-standard)
    1. DOMCursor