React.Halo
- Package
- purescript-react-halo
- Repository
- robertdp/purescript-react-halo
Re-exports from React.Halo.Component
#component Source
component :: forall props state action. String -> ComponentSpec props state action Aff -> Component propsBuild a component by providing a name and a Halo component spec.
Re-exports from React.Halo.Hook
Re-exports from React.Halo.Internal.Control
#HaloM Source
newtype HaloM :: Type -> Type -> Type -> (Type -> Type) -> Type -> Typenewtype HaloM props state action (m :: Type -> Type) a
The Halo evaluation monad. It lifts the HaloF algebra into a free monad.
propsare the component propsstateis the component stateactionis the set of actions that the component handlesmis the monad used during evaluationais the result type
Instances
Functor (HaloM props state action m)Apply (HaloM props state action m)Applicative (HaloM props state action m)Bind (HaloM props state action m)Monad (HaloM props state action m)(Semigroup a) => Semigroup (HaloM props state action m a)(Monoid a) => Monoid (HaloM props state action m a)MonadTrans (HaloM props state action)(MonadEffect m) => MonadEffect (HaloM props state action m)(MonadAff m) => MonadAff (HaloM props state action m)MonadState state (HaloM props state action m)MonadRec (HaloM props state action m)(MonadAsk r m) => MonadAsk r (HaloM props state action m)(MonadTell w m) => MonadTell w (HaloM props state action m)(MonadThrow e m) => MonadThrow e (HaloM props state action m)Parallel (HaloAp props state action m) (HaloM props state action m)
#HaloAp Source
newtype HaloAp :: Type -> Type -> Type -> (Type -> Type) -> Type -> Typenewtype HaloAp props state action (m :: Type -> Type) a
The Halo parallel evaluation applicative. It lifts HaloM into a free applicative.
propsare the component propsstateis the component stateactionis the set of actions that the component handlesmis the monad used during evaluationais the result type
Instances
#unsubscribe Source
unsubscribe :: forall props state action m. SubscriptionId -> HaloM props state action m UnitCancels the event subscription belonging to the SubscriptionId.
#subscribe' Source
subscribe' :: forall props state action m. (SubscriptionId -> Emitter action) -> HaloM props state action m SubscriptionIdSame as subscribe but the event-producing logic is also passed the SuscriptionId. This is useful when events
need to unsubscribe themselves.
#subscribe Source
subscribe :: forall props state action m. Emitter action -> HaloM props state action m SubscriptionIdSubscribe to new actions from an Emitter. Subscriptions will be automatically cancelled when the component
unmounts.
Returns a SubscriptionId which can be used with unsubscribe to manually cancel a subscription.
#fork Source
fork :: forall props state action m. HaloM props state action m Unit -> HaloM props state action m ForkIdStart a HaloM process running independantly from the current "thread". Forks are tracked automatically and
killed when the Finalize event occurs (when the component unmounts). New forks can still be created during the
Finalize event, but once evaluation ends there will be no way of killing them.
Returns a ForkId for the new process.
Re-exports from React.Halo.Internal.Eval
#EvalSpec Source
type EvalSpec :: Type -> Type -> Type -> (Type -> Type) -> Typetype EvalSpec props state action m = { onAction :: action -> HaloM props state action m Unit, onFinalize :: Maybe action, onInitialize :: props -> Maybe action, onUpdate :: props -> props -> Maybe action }
A simpler interface for building the components eval function. The main lifecycle events map directly into
actions, so only the action handling logic needs to be written using HaloM.
#defaultEval Source
defaultEval :: forall props action state m. EvalSpec props state action mThe empty EvalSpec.
Re-exports from React.Halo.Internal.Types
#Lifecycle Source
data Lifecycle props actionThe Halo lifecycle events.
Initializecontains the initial props. It occurs when the component mounts, and only once per component.Updatecontains the previous and new props. It occurs when the component re-renders and the props have changes.Actioncontains the dispatched action. It occurs each time an action is dispatched to be eval'd, up until theFinalizeevent.Finalizeoccurs when the component unmounts.
Constructors
Initialize propsUpdate props propsAction actionFinalize