clear
Summary
Removes all records from the object store.
Method of apis/indexeddb/IDBObjectStoreapis/indexeddb/IDBObjectStore
Syntax
var idbRequest = objectStore.clear();
Return Value
Returns an object of type DOM NodeDOM Node
Examples
store = db.createObjectStore("store1", { autoIncrement: true });
store.put("a"); // Will get key 1
store.delete(1);
store.put("b"); // Will get key 2
store.clear(); // Clears all records from the store
Usage
The method throws a DOMException if
- The transaction this IDBObjectStore belongs to is not active.
- The mode of the transaction this IDBObjectStore belongs to is "readonly".
- Occurs if a request is made on a source object that has been deleted or removed.
Syntax
Standards information
Attributions
Microsoft Developer Network: [Windows Internet Explorer API reference Article]