indexdb for google chrome extension

Go To StackoverFlow.com

1

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

2012-04-05 15:29
by Pavan


1

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);
};
2012-04-12 17:52
by Mohamed Mansour
Ads