js-data-localstorage 3.0.0-alpha.7

js-data logo


Slack Status npm version Circle CI npm downloads Coverage Status Codacy

localStorage adapter for js-data.

Tested on IE9, Chrome 46, Firefox 41 & Safari 7.1 using bs logo

Table of contents

Quick Start

npm install --save js-data js-data-localstorage or bower install --save js-data js-data-localstorage.

Load js-data-localstorage.js after js-data.js.

var adapter = new LocalStorageAdapter();

var store = new JSData.DataStore();
store.registerAdapter('localstorage', adapter, { default: true });

// "store" will now use the localstorage adapter

You can also provide a custom storage medium (it just needs to implement the localStorage API):

var memory = {};

// Turn js-data-localstorage into an in-memory adapter
var memoryAdapter = new LocalStorageAdapter({
  storage: {
    getItem: function (key) {
      return memory[key];
    setItem: function (key, value) {
      return memory[key] = value;
    removeItem: function (key) {
      delete memory[key];

// Turn js-data-localstorage into a sessionStorage adapter
var sessionAdapter = new LocalStorageAdapter({
  storage: sessionStorage

Guides and Tutorials

Get started at http://js-data.io

API Reference Docs

Visit http://api.js-data.io.




Explore the Community.


Find out how to Get Support.


Read the Contributing Guide.


The MIT License (MIT)

Copyright (c) 2014-2016 js-data-http project authors