1.0.5 • Published 8 years ago

simple-local v1.0.5

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

simple-local

NPM version build status Test coverage

Simple wrapper for localStorage. Makes dealing with localStorage less tedious. Calls JSON.parse and JSON.stringify for you and uses debug under the hood to create a smooth debugging experience.

Installation

npm install simple-local

Overview

var local = require('simple-local');

local.set('myKey', {foo: 'bar', bin: 'baz'});

local.get('myKey')
// => {foo: 'bar', bin: 'baz'}

Debug

To enable debugging set in the browser console:

localStorage.debug = 'simple-local';

API

.set(value)

Set the store to contain a value at key.

store.set('key', 12348899);
store.set('config', ['foo', 'bar']);

.get(namespace)

Get a value from the store. Emits a get event which can be namespaced to allow for specific listeners.

store.get('config');
// => ['foo', 'bar']

License

MIT

1.0.5

8 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago