Skip to content

Repository files navigation

Schtät is a state manager pronounced sh-tate

NOTE: This is still a WIP, so there may be issues

Build Status

Schtät is a different approach to state management that takes a flow/pipeline approach to mutations, which, then get distributed to various bindings. (like the observer pattern but with flow and bouncers)

How Do We manage ze schtät?

Wis a state factory representing a single value that can be consumed, mutated, pre-screened, screened and observed at any stage (event sourcing is also possible) to produce consumable views (computed values), or binds which synchronize a state or state view with a property on any object.

importstatefrom'schat.js'constcounter=state({val: 0,screen: val=>typeofval==='number'&&!isNaN(val)&&val%1===0,mut(val){console.log(val)},fail(val,err){thrownewError(`Value: ${val}, Issue: ${err}`)},views: {display: val=>`The current counter value is ${val}.`}})constcounterDisplay=document.querySelector('div.counter')counter.bind(counterDisplay,'textContent','display')setInterval(()=>counter.mutate(val=>val+1),500)

About

Let's manage ze schät: a different approach to state management WIP

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages