Coder Social home page Coder Social logo

jquery-indexeddb's Introduction

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

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); 

jquery-indexeddb's People

Contributors

alexbosworth avatar axe-sneakpeeq avatar axemclion avatar bgotink avatar pixelcort avatar rmobis avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.