st
State management, Redux-like store, slices.
Load with: use st
Quick example
use st
result = stnew("value", 10)
prn(result)
Functions
Store
stnew(reducer, initial_state)
Performs the operation. Takes reducer, initial_state.
stdis(store, action)
Returns true/false based on a condition. Takes store, action.
stget(store)
Performs the operation. Takes store.
stsub(store, listener)
Performs the operation. Takes store, listener.
stuse(store, middleware_fn)
Sets a value. Takes store, middleware_fn.
stapp(middlewares, reducer)
Performs the operation. Takes middlewares, reducer.
Actions
stact(type, payload)
Performs the operation. Takes type, payload.
stact1(type)
Performs the operation. Takes type.
Reducers
stcom(reducers)
Performs the operation. Takes reducers.
Slices (Redux Toolkit style)
stsli(name, initial_state, reducers)
Performs the operation. Takes name, initial_state, reducers.
Selectors
stsel(cb, deps)
Performs the operation. Takes cb, deps.
stmem(cb, deps)
Performs the operation. Takes cb, deps.
Middleware
stlog(logger)
Performs the operation. Takes logger.
stthu()
Performs the operation.
Reactivity (fine-grained)
stsig(initial_value)
Performs the operation. Takes initial_value.
stcom1(signals, compute_fn)
Performs the operation. Takes signals, compute_fn.
Store persistence
stper(store, key, options)
Performs the operation. Takes store, key, options.
DevTools integration
stdev(store)
Performs the operation. Takes store.
Async actions
stasy(pending_type, fulfilled_type, rejected_type, async_fn)
Performs the operation. Takes pending_type, fulfilled_type, rejected_type, async_fn.
Batch updates
stbat(store, actions)
Performs the operation. Takes store, actions.
Notes
- State machine - define states, transitions, guards, actions.