Skip to content
An async client database
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
build
polyfills
src
test initial commit
.gitignore
.jshintrc
Gruntfile.js
LICENSE Initial commit
README.md
asyncdb.amd.js initial commit
asyncdb.js
bower.json
package.json

README.md

AsyncDB

AsyncDB is a lightweight wrapper on top of async-local-storage which allows to have a simple and async localStorage without having to deal with as said: all the performance hazards of localStorage..

All credits goes to async-local-storage API and of course lodash.

Installation

Install with Bower:

bower install --save asyncdb

The component can be used as a CommonJS module, an AMD module, or a global.

API

To use AsyncDB in your JavaScript code, you could simply add it as a script tag:

<script src="asyncdb.js"></script>

Or require it as an AMD or CommonJS module. Then you could use it like:

var AsyncDB = require('asyncdb'),
  db = AsyncDB.load(['users', 'apps']);

db.users.insert({  })
  .then(function(userId){

  });

db.users.findOne({  })
  .then(function(user){

  });

db.apps.findOne({  })
  .then(function(app){

  });

or using ES6 function generators and yield keyword and a helper library like DefineJS or co:

var userId = yield db.users.insert({ });

var user = yield db.users.findOne({ });

var app = yield db.apps.findOne({ });

It is all about making it easy to store offline data in the browser.

Something went wrong with that request. Please try again.