I'm using IndexDB in my google chrome extension, but the requirement is like, based on the user preferences, we need to delete the all the records stored in IndexDB store.
so far code is like this
var db = VidManager.vidDB.db;
var trans = db.transaction(["vid"], IDBTransaction.READ_WRITE);
var store = trans.objectStore("vid");
now store has the values, can some one advice how can i delete all the store values.
thanks
You could just delete each id like the following:
var request = store.delete(id);
request.onsuccess = function(e) {
// Do post processing such as updating UI,
};
request.onerror = function(e) {
console.log(e);
};
Or you could delete the entire store:
var request = trans.deleteObjectStore('vid');
request.onsuccess = function(e) {
// Do post processing such as updating UI,
};
request.onerror = function(e) {
console.log(e);
};