cordova - Cannot load PouchDB in Adobe AIR -
i've gotten pouchdb working in chrome, firefox, , phone gap, can't seem load in adobe air sdk. i've tried versions 15 , 18 of adobe air sdk, versions 3.5 , 3.6 of pouchdb, , adl , adt, , doesn't seem instantiate database objects @ all, , doesn't connect cloudant.
do need library? or not work in adobe air?
here's code i'm using , alert creates.
thanks!
best,
ben
===============================
<!doctype html> <html class="ui-mobile"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta charset="utf-8"> <title>not working</title> <script src="cordova.js"></script> <script src="phoneincludes/jquery.js"></script> <script src="phoneincludes/es6-promise.min.js"></script> <script src="phoneincludes/es5-shim.min.js"></script> <script src="phoneincludes/pouchdb.min.js"></script> <script> var db, remotedb; var err = function(err) { alert(err) }; var changes = function(change) { $('body').append('<div>' + json.stringify(change.doc,null,4) + '</div>'); }; function dispatch(fn, args) { fn = (typeof fn == "function") ? fn : window[fn]; return fn.apply(this, args || []); } $(function() { db = new pouchdb('todo'); alert(json.stringify(db,null,4)); remotedb = new pouchdb('https://user:pass@domain.cloudant.com/todo'); db.replicate.from(remotedb, {retry: true, filter: 'app/nowhammies'}) .on('complete', function() { db.alldocs({include_docs: true}).then(function(docs) { (var row in docs.rows) { dispatch(changes, [docs.rows[row]]); } }); }).on('error', err); }); </script> </head> <body> </body> </html>
=======================================
{ "__opts": {}, "prefix": "_pouch_", "_events": {}, "taskqueue": { "isready": false, "failed": { "message": "adapter missing", "code": 404, "line": 9, "expressionbeginoffset": 64839, "expressionendoffset": 64891, "sourceid": 567532592, "sourceurl": "app:/phoneincludes/pouchdb.min.js" }, "queue": [] }, "_db_name": "todo" }
=======================================
thanks answer, @jessemonroy650.
strangely, doesn't seem deviceready event ever fires in adobe air. instance, code outputs "zero" instead of "one". adobe air different system phonegap? i'm stumped why work in 1 not other...
=======================================
<!doctype html> <html> <head> <script src="jquery.js"></script> <script> function onload() { $('#output').html('zero'); document.addeventlistener("deviceready", ondeviceready, false); } function ondeviceready() { $('#output').html('one'); } </script> </head> <body onload="onload()"> <div id="output">hello</div> </body> </html>
afaik pouchdb has never supported adobe air.
Comments
Post a Comment