1.1.0 • Published 9 years ago

localdatastore v1.1.0

Weekly downloads
2
License
-
Repository
github
Last release
9 years ago

Build Status Code Climate

Dependency Status devDependency Status peerDependency Status

localdatastore

Unified implementation for saving data in browsers. Gracefully degrades from IndexedDB to WebSQL to Heap.

localdatastore is a fast and simple storage library for JavaScript. It improves the offline experience of your web app by using asynchronous storage (IndexedDB or WebSQL) with a simple API.

localdatastore uses Heap in browsers with no IndexedDB or WebSQL support.

To use localdatastore, just drop a single JavaScript file into your page:

<TBD>
<script src="localdatastore.js"></script>

or install with npm:

npm install localdatastore

This module is compatible with browserify and lasso.

Usage Details

var ds = require('localdatastore');


var selectedDataStore = ds.get();


var resolvedDataStore = ds.get(function() {
    var ua = window.navigator.userAgent.toLowerCase();
    if (ua.indexOf('msie') > -1) {
        return 'heap';
    } else if (ua.indexOf('safari') > -1 && ua.indexOf('chrome') === -1) {
        return 'heap';
    }
    return 'idb';
});


var resolvedDataStore = ds.get('heap');


var database1 = selectedDataStore.init('DB_NAME_1', meta);
database1.insert();

var database2 = selectedDataStore.init('DB_NAME_2', meta);
database2.insert();

selectedDataStore.destroy('DB_NAME_2');
1.1.0

9 years ago

0.1.7

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago