Module
Redox.Store
- Package
- purescript-redox
- Repository
- coot/purescript-redox
#SubscriptionId Source
#getState Source
getState :: forall state m. MonadEffect m => Store state -> m state
#getSubscriptions Source
getSubscriptions :: forall state m. MonadEffect m => Store state -> m (Array (state -> Effect Unit))
Get subscriptions.
#runStoreSubscriptions Source
runStoreSubscriptions :: forall state m. MonadEffect m => Store state -> m Unit
#modifyStore Source
modifyStore :: forall state' state m. MonadEffect m => (state -> state') -> Store state -> m (Store state')
#mkStore Source
mkStore :: forall state m. MonadEffect m => state -> m (Store state)
#setState Source
setState :: forall state m. MonadEffect m => Store state -> state -> m (Store state)
#subscribe Source
subscribe :: forall state m. MonadEffect m => Store state -> (state -> Effect Unit) -> m SubscriptionId
Subscribe 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 state m. MonadEffect m => Store state -> SubscriptionId -> m Unit
Remove a subscription with a given id.