DataStoreCursor.close()
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
#
Syntax#
ReturnsVoid.
#
ExampleIn 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.