var indexedDB = window.indexedDB || window.webkitIndexedDB || window.mozIndexedDB || window.msIndexedDB;
var IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || { READ_WRITE: "readwrite" };;
var db;
var transaction, objectStore;
// "IndexDB" is your indexed db name (database)
var request = indexedDB.open("IndexDB", 1);
request.onsuccess = function (evt) {
db = request.result;
//"indexobject" is your indexdb object (table)
transaction = db.transaction("indexobject", "readwrite");
objectStore = transaction.objectStore("indexobject");
// clear all the data out of the object store
var objectStoreRequest = objectStore.clear();
objectStoreRequest.onsuccess = function(event) {
// report the success of our clear operation
console.log('clear '+"indexobject");
};
};
var IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || { READ_WRITE: "readwrite" };;
var db;
var transaction, objectStore;
// "IndexDB" is your indexed db name (database)
var request = indexedDB.open("IndexDB", 1);
request.onsuccess = function (evt) {
db = request.result;
//"indexobject" is your indexdb object (table)
transaction = db.transaction("indexobject", "readwrite");
objectStore = transaction.objectStore("indexobject");
// clear all the data out of the object store
var objectStoreRequest = objectStore.clear();
objectStoreRequest.onsuccess = function(event) {
// report the success of our clear operation
console.log('clear '+"indexobject");
};
};
Komentar
Posting Komentar