vigour-state
Fast reactive state management for observables. Inspired by virtual-dom tree-diffing algorithms and merkle-trees.
Inherits or extends vigour-observable
simple
var State = var state = statestate
any
var State = var state = state// fires an update, subscribed to any field with a titlestate
switch
switch between different subscriptions based on conditions
var State = var state = state state // set the field to bird// this will fire updates for the birds class and dietstate // fires updatesstatebirdclass // will not fire since the bird has no subscription on its jobstatebird // set the field to someone// this will fire updates for the persons name and jobstate // will not fire since the person has no subscription on its dietstatesomeone
root
var State = var state = state// does not fire, since we don't have field.another yetstate // now it does firestate
self
var State = var state = a: field: 'bye' field: val: '$root.a' // makes a reference to root.a field: 'hello' state
parent
var State = var state = state// does not fire, since we don't have field.another yetstate // now it does firestate
test
var State = var state = state // will fire for interstellar's title and descriptionstate // fires for interstellar (remove) and fires for jump street's title and descriptionstatequery
Or any combination of the above
inject
convert any observable to a state-observable
var Observable = var obs = inject: obs