The DataStore interface of the Data Store API represents a retrieved set of data, and includes standard properties for accessing the store's name, owner, etc., methods for reading, modifying and syncing data, and the onchange event handler for reacting to changes to the data.
The add() method of the DataStore interface adds a new record to the data store; if the record you are attempting to add already exists, it will throw an exception.
The clear() method of the DataStore interface deletes all records from the data store, leaving it empty.
The get() method of the DataStore interface retrieves one or more objects from the current data store.
The getLength() method of the DataStore interface returns the number of records stored in the current data store.
The name read-only property of the DataStore interface returns the name of the current data store.
The onchange event handler of the DataStore interface fires when a change is made to the data store. Its main use is to synchronize different apps that are using the data store when a change is made. When fired, this event returns a DataStoreChangeEvent, which can be used to handle the change that was just made. Alternatively, when the event fires you could create a DataStoreCursor and iterate through all the records, if needed.
The owner read-only property of the DataStore interface returns the name of the app that owns the current data store.
The put() method of the DataStore interface updates an existing record in the data store.
The readOnly read-only property of the DataStore interface returns a boolean indicating whether the current data store is read-only.
The remove() method of the DataStore interface deletes one or more objects from the current data store.
The revisionId read-only property of the DataStore interface returns the current data store's current revision ID. This ID can be tracked, allowing you to synchronize apps using the data store to this point in its history.
The sync() method of the DataStore interface opens a cursor that allows you to step through any changes that have taken place in the data store going back to a particular revision ID, and run code in response to different types of change.