axemclion / jquery-indexeddb

An IndexedDB Plugin for Jquery.
Other
195 stars 70 forks source link

Added a get method to index #17

Closed bgotink closed 11 years ago

bgotink commented 11 years ago

An index allows to get objects from the database using the indexed value as key, so I've added this capability to jQuery-IndexedDB.

Syntax:

$.indexedDB(database)
    .objectStorage(storage)
    .index(index)
    .get(indexedValue)
    .then(onSuccess, onError);
axemclion commented 11 years ago

If the modes are changed to "readonly", how will it work on older browsers that require numeric modes ? The reason I was using constants like IDBTransaction.READ_ONLY is so that the mode can be numeric or strings, based on the browser version.

axemclion commented 11 years ago

I think I will take your first commit, add that, and try fixing the second commit in a more generic way. Will that work ?

axemclion commented 11 years ago

Added index.get and index.getKey for Firefox, and Chrome too. Note that chrome does not seem to have index.get method.

Commit: 02e905f028823b746889e616594b59d75e0d8fed