Module
Redox.Store
- Package
- purescript-redox
- Repository
- coot/purescript-redox
#CreateRedox Source
data CreateRedox :: EffectEffect for creating Redox Store
#WriteRedox Source
data WriteRedox :: EffectEffect for writing to the store
#SubscribeRedox Source
data SubscribeRedox :: EffectEffect for (un)subscribing to the store
#ReadOnlyRedox Source
type ReadOnlyRedox = (read :: ReadRedox)#WriteOnlyRedox Source
type WriteOnlyRedox = (write :: WriteRedox)#ReadWriteRedox Source
type ReadWriteRedox = (read :: ReadRedox, write :: WriteRedox)#ReadWriteSubscribeRedox Source
type ReadWriteSubscribeRedox = (read :: ReadRedox, subscribe :: SubscribeRedox, write :: WriteRedox)#CreateReadWriteSubscribeRedox Source
type CreateReadWriteSubscribeRedox = (create :: CreateRedox, read :: ReadRedox, subscribe :: SubscribeRedox, write :: WriteRedox)#mkStore Source
mkStore :: forall eff e state. state -> Eff (redox :: RedoxStore (create :: CreateRedox | e) | eff) (Store state)Make store with initial state. Store is a mutable container with a subscription mechanism.
#SubscriptionId Source
#subscribe Source
subscribe :: forall eff' eff e state. Store state -> (state -> Eff eff' Unit) -> Eff (redox :: RedoxStore (subscribe :: SubscribeRedox | e) | eff) SubscriptionIdSubscribe to store updates. Note that store updates are not run by the store itself. That is left to dispatch or the DSL interpreter. It returns id of the subscribed callback. You can use it to remove the subscription.
#unsubscribe Source
unsubscribe :: forall eff e state. Store state -> SubscriptionId -> Eff (redox :: RedoxStore (subscribe :: SubscribeRedox | e) | eff) UnitRemove a subscription with a given id.
#modifyStore Source
modifyStore :: forall eff e state' state. (state -> state') -> Store state -> Eff (redox :: RedoxStore (read :: ReadRedox, write :: WriteRedox | e) | eff) (Store state')#setState Source
setState :: forall eff e state. Store state -> state -> Eff (redox :: RedoxStore (write :: WriteRedox | e) | eff) (Store state)#getState Source
getState :: forall eff e state. Store state -> Eff (redox :: RedoxStore (read :: ReadRedox | e) | eff) state#getSubscriptions Source
getSubscriptions :: forall eff e state. Store state -> Eff (redox :: RedoxStore (read :: ReadRedox | e) | eff) (Array (state -> Eff (redox :: RedoxStore (read :: ReadRedox | e) | eff) Unit))Get subscriptions.
#performRedoxEff Source
performRedoxEff :: forall e a. Eff (redox :: RedoxStore e) a -> a