Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/drublic/store
A JavaScript lib for storing stuff
https://github.com/drublic/store
localestorage pubsub storing
Last synced: 19 days ago
JSON representation
A JavaScript lib for storing stuff
- Host: GitHub
- URL: https://github.com/drublic/store
- Owner: drublic
- License: mit
- Created: 2015-04-16T20:58:11.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-21T10:11:38.000Z (over 7 years ago)
- Last Synced: 2024-10-09T14:52:27.406Z (27 days ago)
- Topics: localestorage, pubsub, storing
- Language: JavaScript
- Size: 15.6 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Store - vanilla-store
A JavaScript storing library
[![Build Status](https://api.travis-ci.org/drublic/Store.svg)](http://travis-ci.org/drublic/Store)
[![Coverage Status](https://coveralls.io/repos/drublic/Store/badge.svg?branch=master)](https://coveralls.io/r/drublic/Store?branch=master)## 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](https://github.com/drublic/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