The close() method of the DataStoreCursor interface makes a request to terminate the cursor.

Note: The Data Store API is available in Web Workers, from Firefox 32 onwards (Firefox OS 2.0; see bug 949325.)

Syntax

cursor.close();

Returns

Void.

Example

In the following example, we run DataStore.sync() to create a DataStoreCursor object allowing us to loop through any additions since the code last accessed the data store and update the data display as necessary.

The cursor is passed to the runNextTask() function, which calls DataStoreCursor.next to start the process of managing the next task — the resulting DataStoreTask object is passed to the manageTask() function to work out what to do with it. runNextTask() is then called repeatedly by manageTask() until the cursor has finished working through all the records. If an operation of type clear is found, cursor.close() is called to close the cursor.

Specifications

The discussion concerning this API's creation happened in various Mozilla mailing lists and other places. A summary of the discussion and further pointers can be found on the Mozilla Wiki. For further feedback and questions, send mail to the dev-webapi mailing list.

Browser compatibility

Supported in Firefox OS 1.0.1.
Available in web workers in Firefox OS 2.0.