This page is In Progress

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

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

View live example

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