0

Has anyone had success running ydn-db inside of a FF Jetpack add-on? I've got it partially working but am now stuck.

I'm using ydn.db-isw-sql-e-cur-qry-dev.js v1.03. I had to modify it to require Jetpack's indexeddb library, once I did that ydn's put and get methods seem to work fine. So, this works as expected:

var db = new ydn.db.Storage('test');
q = db.put({name: "store1", keyPath: "id"}, {id: "id1", value: "value1"});
q.done(function(x){ console.log("put done",x) });
q.fail(function(x){ console.log("put fail",x) });
var clog = function(r) { console.log(r.value); }
db.get("store1", "id1").done(clog);

However 'results' has 0 length below:

db.from('store1').list(100).done(
function(results){
console.log('done',results.length);
for(var i in results){
    console.log(i,results[i].id);
}});

I've confirmed that the above works in Chrome and in FF in a regular web page.

akb
  • 61
  • 4

1 Answers1

0

When YDN-DB is not behaving expecting for simple cases, there may be other problem. Try running with logging before instantiating ydn.db.Storage as follow:

ydn.debug.log('ydn-db', 'finest')

This will log very noisy log message to console. You should get idea what is going wrong.

Kyaw Tun
  • 12,447
  • 10
  • 56
  • 83