Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
An IndexedDB Plugin for Jquery.
Branch: gh-pages
Pull request Compare This branch is 68 commits behind axemclion:gh-pages.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
demo
docs
example
lib
test
.project
LICENSE
README.md
index.html
jquery.indexeddb.js
jquery.indexeddb.old.js
package.json
style.css

README.md

Jquery Plugin for the IndexedDB API

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

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"]();                
        }
    };
};

The above code would increase if objects have to be created with version transaction, and error conditions are to be added.

$.indexeddb("BookShop-1").objectStore("BookList").openCursor().each(write); 
Something went wrong with that request. Please try again.