Giter Site home page Giter Site logo

tolbahadi / db.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aaronpowell/db.js

0.0 2.0 0.0 441 KB

db.js is a wrapper for IndexedDB to make it easier to work against

Home Page: http://aaronpowell.github.com/db.js/

License: MIT License

db.js's Introduction

db.js

db.js is a wrapper for IndexedDB to make it easier to work against, making it look more like a queryable API.

Usage

Add a reference to db.js in your application before you want to use IndexedDB:

<script src='/scripts/db.js'></script>

Once you have the script included you can then open connections to each different database within your application:

var server;
db.open({
     server: 'my-app',
     version: 1, {
         people: {
             key: { keyPath: 'id' , autoIncrement: true }
         }
     }
}).done( function ( s ) {
	server = s	
});

A connection is intended to be persisted and you can perform multiple operations while it's kept open. Check out the /tests/public/spec folder for more examples.

Adding items

server.people.add( {
    firstName: 'Aaron',
    lastName: 'Powell'
} ).done( function ( item ) {
    //item stored
});

Removing

server.people.remove( 1 ).done( function ( item ) {
    //item stored
});

Querying

server.people.query( 'firstName' , 'Aaron' )
    .execute()
    .done( function ( results ) {
        //do something with the results
    });

The MIT License

Copyright (c) 2012 Aaron Powell

db.js's People

Contributors

aaronpowell avatar

Watchers

El Hady Tolba avatar James Cloos 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.