Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Still Got an Error of IndexedDB on PhoneGap #260

Closed
erhanyasar opened this issue Aug 18, 2016 · 4 comments
Closed

Still Got an Error of IndexedDB on PhoneGap #260

erhanyasar opened this issue Aug 18, 2016 · 4 comments
Assignees
Milestone

Comments

@erhanyasar
Copy link

erhanyasar commented Aug 18, 2016

Briefly, after I wanted to add an IndexedDB plugin I just faced minimatch issue (npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue #13323) and then reinstalled whole the node & npm hence, the phonegap didn't work properly if I try to add platform 'android'. Adding below the parameters to my 'document.ready' function wasn't a solution yet and then as a result;

$(document).ready(function () {

  const setGlobalVars = require('indexeddbshim');
  global.window = global;
  setGlobalVars();
  shimIndexedDB.__useShim();

screen shot 2016-08-17 at 19 20 52

I couldn't think of how to solve right now. Actually I tried some other IndexedDB plugins too, hence anyone didn't satisfying enough yet to solve the problem. Maybe not this but they also remain with same kind of errors.

Many thanks in advance.

@erhanyasar
Copy link
Author

erhanyasar commented Oct 26, 2016

Well I needed an update to take a bit more attention. I searched for IndexedDB with Cordova for a few months and after many failures of each script, plugin or modules, I decided take a consultancy if anyone consider and if it's not unappropriate.

I tried maybe more scripts, plugins (indexeddb-async, MSOpentech/cordova-plugin-indexeddb, and DickvdBrink/cordova-indexeddb) and npm packages (backbone-idb, db.js, dexie, idb-wrapper, indexeddbshim, pseudo-worker, treo, ydn.db) than below hence not a single solution I reached yet. I tried all either one by one or all together but I'm not sure how to deal with the shim hierarchy.

    <script type="text/javascript" src="cordova.js"></script>
    <script src="http://172.20.10.6:8080/target/target-script-min.js#anonymous"></script>
    <script src="js/shim/require.js"></script>
    <script>
        window.addEventListener("IndexedDBShimInit",load);
    </script>
    <script src="js/shim/treo.js"></script>
    <script src="js/shim/treo-websql.js"></script>
    <script src="js/shim/treo-promise.js"></script>
    <script>
        var db = window.treo('my-db', schema)
        .use(treoWebsql())
        .use(treoPromise());
    </script>
    <script src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s=" crossorigin="anonymous"></script>
    <script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
    <script src="js/shim/jquery.min.js"></script>
    <script src="js/shim/indexeddbshim.js"></script>
    <script src="js/shim/jquery.indexeddb.js"></script>
    <script src="js/shim/idbstore.min.js"></script>
    <script src="js/shim/db.js"></script>
    <script src="js/shim/dexie.min.js"></script>
    <script src="js/shim/1.4.3-ydn.db-is-core-e-qry-dev.js"></script>
    <script src="js/shim/shim.js"></script>
    <script>
        window.indexedDB = { polyfill : true };
    </script>
    <script src="js/shim/indexedDB.polyfill.js"></script>
    <script src="https://unpkg.com/pseudo-worker/dist/pseudo-worker.js"></script>
    <script src="https://unpkg.com/pseudo-worker/dist/pseudo-worker.polyfill.js"></script>

After all and not sure implemented the issues truly #167, #144 and dexie.js/issues#63 I'm getting following errors of require parameter if I don't include require.js as first script and the error below if I include then.
2
3

Here I kindly ask for some help via tagging people realised into indexedDB with issues.
@axemclion @brettz9 @BigstickCarpet @capsula4 @andygup @jensarps @DickvdBrink @dfahlander @jamiejhill @nolanlawson @alekseykulikov

@brettz9
Copy link
Collaborator

brettz9 commented Oct 27, 2016

I'm a bit focused on finishing some current work before I may have a chance to look at platform-specific bugs (and no promises on that even). I'm hoping to get ready for a new release and hopefully around that time we can get people testing, including those on different devices/environments and those responsible for other libraries (such as Treo, Dexie, etc.).

@brettz9
Copy link
Collaborator

brettz9 commented May 4, 2017

Firstly, in looking at your original post more carefully, it looks like you are attempting to use the Node API instead of just using the browser's IndexedDB API (first optionally forcing its use (where WebSQL is available) via shimIndexedDB.__useShim()). require is generally only for Node.js on the server (unless perhaps using requirejs but we don't support AMD-style modules).

So, you can:

  1. Start with shimIndexedDB.__useShim() to force use of the shim (it will not automatically be used except where support is very poor).
  2. Use the native IndexedDB methods like indexedDB.open().

Secondly, we've added a new release, so it'd be best to test against the latest release candidate.

I will close but feel free to comment further or reopen if you are having problems with the latest release.

@brettz9 brettz9 closed this as completed May 4, 2017
@erhanyasar
Copy link
Author

erhanyasar commented Jun 14, 2017

Thanks for your effort @brettz9, I was not very intellectual about node.js, PhoneGap and indexedDB's API either even if I was the one try to implement this app on PhoneGap. So that, there was very much mistakes at the same time I had to struggle. Anyway before IndexedDB, PhoneGap is still buggy and I even can't make it work for my app since three months or maybe more. Therefore may the problem be solved but I'll be able to know it in the future hopefully and let you know for any progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants