I am new to IndexedDB and sencha touch framework. While learning IndexedDB in sencha, I came across a problem, the solution which I searched a lot but could not find any.
Let me show you my chunk of code first
var db;
var myRequest = indexedDB.open("testDB", 8);
myRequest.onupgradeneeded = function (e) {
console.log("upgrading...");
var thisDB= e.target.result;
if(!thisDB.objectStoreNames.contains("FirstOS")){
thisDB.createObjectStore("FirstOS");
}
};
myRequest.onsuccess = function (e) {
console.log("success...");
db= e.target.result;
};
myRequest.onerror = function (e) {
console.log("error occured");
};
var transaction = db.transaction(["FirstOS"],"readwrite");
var store= transaction.objectStore("FirstOS");
It throws an exception saying
Uncaught TypeError: Cannot read property 'transaction' of undefined
Any help would be appreciated. Thank you.