This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

mobx-keys-store
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

mobx-keys-store

Build Status Dependency Status devDependency Status

Installation

npm install mobx-keys-store

Usage

import KeysStore from 'mobx-keys-store';
 
const initialState = {};
const store = new KeysStore(initialState);
 
/*
 * Observe the store and its properties
 */
 
store.setItem('foo', 1);
store.increaseItem('foo');

Documentation

Constructor

The constructor can receive an object with initial keys.

Store methods

setItem(name, value)

setItem adds a new or updates an existing property.

removeItem(name)

removeItem removes a property from the store.

increaseItem(name, [amount=1])

increaseItem will increase the value of the selected property.

decreaseItem(name, [amount=1])

decreaseItem will decrease the value of the selected property

Note

If you try to observe a property which doesn't yet exist, you might not be notified once the property is added. That's why it might be best to add the property to the initial store values.

License

The MIT License

© 2016 Infinum Inc.

Package Sidebar

Install

npm i mobx-keys-store

Weekly Downloads

2

Version

1.1.0

License

MIT

Last publish

Collaborators

  • infinumcom
  • jjanus
  • danipavic
  • safo6m
  • fvoska
  • darkokukovec
  • infinumco