https://github.com/drublic/store
A JavaScript lib for storing stuff
https://github.com/drublic/store
localestorage pubsub storing
Last synced: about 1 year 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 (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-03-21T10:11:38.000Z (over 9 years ago)
- Last Synced: 2025-04-07T03:35:24.952Z (about 1 year ago)
- Topics: localestorage, pubsub, storing
- Language: JavaScript
- Size: 15.6 KB
- Stars: 3
- Watchers: 2
- 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
[](http://travis-ci.org/drublic/Store)
[](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