I have created a DB with YDN :
var db = new ydn.db.Storage('our_db', our_schema);
The second time, I test if this DB exists. In case of success I would like to call this DB to apply db.put() and other stuffs...
How do I retrieve this DB into the variable "db" in this case ?
My test code :
if (window.indexedDB){ // if browser supports IndexedDB, create IndexedDB DB
var request = window.indexedDB.open("our_db", 1);
request.onerror = function(event) {
};
request.onsuccess = function(event) {
var db = ?????? ;
};
request.onupgradeneeded = function(event) {
// create the datastore
var db = new ydn.db.Storage('our_db', our_schema);
console.log("New storage !");
};
}
In case if you have better ideas in mind... Thanks for advices !