pathon
doing one job - and doing it great - observable data structures. No more architecture or workflow dependence. Just observable state with maximum performance for subscribers (without selectors and etc.).
Basic
Complex
React integration
npm install --save pathon
Or
yarn add pathon
import { path, immutablePreset } from 'pathon';
const pathRoot = path('root', { count: [1, 1, 1], individualCount: 1 }, immutablePreset);
const pathCount = pathRoot.path('count');
const {
// Every method is a function:
get, // get `path` value
set, // set (and merge) value to `path`
del, // del value by key
batch, // accept callback which u can do many set's without call subscriptions (only after `batch`)
watch, // subscribe to updates
unwatch, // unsubscribe
path, // create new `path` - element of current value by specified key
getPath, // get array of keys from root to current `path`
} =
pathRoot || pathCount || pathCount.path('0');
If you will update inner [property] path
- all parent path
's watchers will be called but other watchers of path
's in neighbour branches will not be called
Except immutablePreset
you can use any preset for any data-structure. Anyway you can choose not to specify a preset - by default accepted structure will update by mutations.
Look at the examples for detailed reference
- Docs
- Types
it's sound like
pazone