aaronpowell / db.js

db.js is a wrapper for IndexedDB to make it easier to work against
http://aaronpowell.github.com/db.js/
MIT License
820 stars 142 forks source link

Allow `noServerMethods` option and otherwise throw error upon loading… #147

Closed brettz9 closed 8 years ago

brettz9 commented 8 years ago

… store names which conflict with db.js methods; add test and docs

To address issue #136

brettz9 commented 8 years ago

I've added a commit to handle the case that you suggested (and I was mistakenly checking for conflicts against the db name instead of against the object store). I did still think it was useful (via the second commit) to have a check to confirm that query was a function (as opposed to an object) as it ensures that query is still available as a server method (and not an object store), but I also added a test specifically to check that a valid store name was not present with noServerMethods added.

The first commit also changes things to self-close the connection since otherwise the db might remain blocked.

Let me know if you want me to revert the other changes in the first commit to reject instead of throw--I thought it might provide a clearer flow.

brettz9 commented 8 years ago

Are you ok with my further modifications here?