localforage - fast and simple storage library for javascript

8

Upload: sergey-romaneko

Post on 27-Jul-2015

369 views

Category:

Technology


1 download

TRANSCRIPT

BENEFITS

● Asynchronous API with callbacks● IndexedDB, WebSQL, and localStorage

drivers (managed automatically; the best driver is loaded for current browser)

● Ability to create and use custom drivers.● Blob and arbitrary type support, so you can

store images, files, etc.

INSTALL

bower install localForage

USAGE

<script src=”localforage.js”></script>

EXAMPLES

localforage.setItem('key', 'some value', function(err, value) { console.log(value);});

localforage.getItem('key', function(err, value) { console.log(value);});

localforage.removeItem('key', function(err) { console.log('Key is cleared!');});

SUPPORTED TYPES

ArrayArrayBufferBlobFloat32ArrayFloat64ArrayInt8ArrayInt16ArrayInt32ArrayNumber

ObjectUint8Array Uint8ClampedArrayUint16Array Uint32ArrayString

SUPPORTED BROWSERS

IE 10+IE Mobile 10+, Firefox 10+Firefox for Android 25+, Chrome 23+,Chrome for Android 32+Opera 15+Safari 3.1 (includes Mobile Safari)Stock Android Browser (2.1+)

LINKS

DOCUMENTATIONhttps://mozilla.github.io/localForage/

GITHUB REPOSITORYhttps://github.com/mozilla/localForage