Skip to content
An IndexedDB Plugin for Jquery.
JavaScript CSS Shell Scala
Find file
Latest commit ed5507c Nov 23, 2013 Parashuram N Fixed library path in dist
Failed to load latest commit information.
demo Fixed library path in dist Nov 23, 2013
dist Fix for Android browsers. Oct 30, 2013
docs (Fix #36) Correcting the way ranges are handled May 22, 2013
example
lib Made documentation clearer Apr 28, 2013
src Fix for Android browsers. Oct 30, 2013
test Corrected Qunit paths and test cases Aug 3, 2013
.gitignore Added travis for CI Nov 14, 2012
.jshintrc Added global "use strict"; Jun 4, 2013
.project Added demoer and test directories Feb 2, 2012
.travis.yml Changed github user to github token Jun 22, 2013
CONTRIBUTING.md Added new way to do travis Jun 22, 2013
GruntFile.js Changed github user to github token Jun 23, 2013
LICENSE Added license - MIT Aug 25, 2012
README.md Added new way to do travis Jun 22, 2013
index.html Made documentation clearer Apr 29, 2013
indexeddb.jquery.json Moved files around Mar 25, 2013
package.json (Fix #36) Correcting the way ranges are handled May 23, 2013
style.css Styled the index page May 21, 2012
travis.sh [Travis] Push to gh-pgaes also when build is successfull Aug 3, 2013

README.md

Jquery Plugin for the IndexedDB API Build Status

IndexedDB is a database inside a browser to save and retrieve objects on the browser/client. The JQuery IndexedDB Plugin is a wrapper on the IndexedDB API for JQuery.

Links

Summary

The Jquery IndexedDB Plugin brings to goodness of Jquery to the browser's native IndexedDB API. It supports method chaining, promises and smart defaults, enabling you to get more done with less code. It also abstracts out differences in browser implementations.

Code

The code written with the jQuery plugin is pretty simple. It looks something like

    $.indexeddb("BookShop-1").objectStore("BookList").openCursor().each(write); 

A typical operation using the IndexedDB API would involve using the request model, creating transactions, checking for existence of object store using error responses and exceptions and then finally getting to the part where the data is actually iterated over.

    var request = window.indexedDB.open("BookShop-1");
    request.onsuccess = function(event){
        var db = request.result;
        var transaction = db.transaction(["BookList"], IDBTransaction.READ_WRITE);
        var objectStore = transaction.objectStore("BookList");
        var request = DAO.objectStore.openCursor();
        request.onsuccess = function(event){
            var cursor = request.result;
            if (cursor) {
              write(cursor.key + "" + cursor.value);
              cursor["continue"]();                
            }
        };
    };

Read more about the API syntax in the (documentation)[https://github.com/axemclion/jquery-indexeddb/blob/master/docs/README.md].

Building

Node is required to build this project.

  • npm insall -g grunt-cli # to install the grunt command line
  • npm install # to install all other dependencies from the package.json
  • Run one of the following grunt commands
    • grunt # to just minify, lint and build the source. Final file available in dist/ folder
    • grunt dev # to start a web server. Navigate to http://127.0.0.1:8080/test/ to run Qunit tests
Something went wrong with that request. Please try again.