Skip to content

drublic/Store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Store - vanilla-store

A JavaScript storing library

Build Status Coverage Status

Install

npm install --save vanilla-store

API

Store.create(String category, Array items|Object item);
Store.update(String category, Array items|Object item);
Store.get(String category, String id);
Store.remove(String category, Array items|Object item);
Store.clean(String category);
Store.restore(String category, Array items);

PubSub Events

Store.create, Store.update, Store.remove and Store.clean all trigger events with PubSub. These events can be used to trigger actions based on the according events.

Calling Store.create('Test', {…}) will trigger an event Test.create; Store.update('Test', {…}) will trigger Test.update and so on.

Just requesting data with getAll, getAllByCategory and find does not publish events.

Dependencies

If you want to store nested objects with Store please make sure to use a deep object extend function. You can do so by providing a global extend function, include jQuery or Lodash/Underscore.

Tests

Please run npm run test. Tests are written utilizing Jasmine.

License

MIT - 2015-2017, Hans Christian Reinl