1.0.3 • Published 7 years ago

my-little-store v1.0.3

Weekly downloads
-
License
GPL-3.0
Repository
-
Last release
7 years ago

Description

A simple and fast store to use as truth source and update your reactive components.

Fertures

  • Fast
  • Minimalistic
  • Simple to use
  • Can be used to create your own store
  • No proxies inside!
  • No reducers, dispatchers or other nonsence

Instalation

npm i my-little-store -S
yarn add my-little-store

Usage

Constructor

ArgumentsDescription
valuesobject with initial values that will be stored

Methods

NameargumentsDescription
add{prop1: value1[, prop2:value2[, ...[, propN:valueN]]]}adds new prop(s) to store
removeprop | [prop1[, prop2[, ...[, propN]]]]removes single or multiple props from store
update{prop1: value1[, prop2:value2[, ...[, propN:valueN]]]}updates multiple props fom provided object
subscribecallbackwill fire your callback when any prop changes with current values
unsubscribecallbackunsubscribe a callback from store updates
onprop, callbackwill fire your callback on prop updates with value
offprop, callbackunsubscribe from prop updates
oneprop, callbacksubscribe for next change
addMiddlewareprop, callbackadd a middleware function that will be called before the value setter, must return a value
removeMiddlewarepropremoves middleware from prop

Getters

NameReturnsDescription
propsarrayReturns an object with prop:prop pairs
valuesvaluesReturns object containing stored items

Examples

Simple usage

Complete API documentation

API

Development

Install requirements

yarn
npm i

Build

yarn build
npm run build

Test

yarn test
npm test

Generate API documentation

yarn docs
npm run docs

TODO

  • tests

Contibutions

Yes, please!

Also this

Written with ❤❤❤ by Wasteland Fluttershy.