Module

Halogen.Query.EventSource

Package
purescript-halogen
Repository
slamdata/purescript-halogen

#EventSource Source

newtype EventSource f m

Constructors

#SubscribeStatus Source

data SubscribeStatus

The status of an EventSource subscription. When a query raised by an EventSource evaluates to Done the producer will be unsubscribed from.

Constructors

Instances

#unEventSource Source

unEventSource :: forall f m. EventSource f m -> m { done :: m Unit, producer :: Producer (f SubscribeStatus) m Unit }

#interpret Source

interpret :: forall f g m. Functor m => (f ~> g) -> EventSource f m -> EventSource g m

#hoist Source

hoist :: forall f m n. Functor n => (m ~> n) -> EventSource f m -> EventSource f n

#eventSource Source

eventSource :: forall f m a eff. MonadAff (avar :: AVAR | eff) m => ((a -> Eff (avar :: AVAR | eff) Unit) -> Eff (avar :: AVAR | eff) Unit) -> (a -> Maybe (f SubscribeStatus)) -> EventSource f m

Creates an EventSource for a callback that accepts one argument.

  • The first argument is the function that attaches the listener.
  • The second argument is a handler that optionally produces a value in f.

#eventSource' Source

eventSource' :: forall f m a eff. MonadAff (avar :: AVAR | eff) m => ((a -> Eff (avar :: AVAR | eff) Unit) -> Eff (avar :: AVAR | eff) (Eff (avar :: AVAR | eff) Unit)) -> (a -> Maybe (f SubscribeStatus)) -> EventSource f m

Similar to eventSource but allows the attachment function to return an action to perform when the handler is detached.

#eventSource_ Source

eventSource_ :: forall f m eff. MonadAff (avar :: AVAR | eff) m => (Eff (avar :: AVAR | eff) Unit -> Eff (avar :: AVAR | eff) Unit) -> f SubscribeStatus -> EventSource f m

Creates an EventSource for a callback that accepts no arguments.

  • The first argument is the function that attaches the listener.
  • The second argument is the query to raise whenever the listener is triggered.

#eventSource_' Source

eventSource_' :: forall f m eff. MonadAff (avar :: AVAR | eff) m => (Eff (avar :: AVAR | eff) Unit -> Eff (avar :: AVAR | eff) (Eff (avar :: AVAR | eff) Unit)) -> f SubscribeStatus -> EventSource f m

Similar to eventSource_ but allows the attachment function to return an action to perform when the handler is detached.

#catMaybes Source

catMaybes :: forall m a r. MonadRec m => Producer (Maybe a) m r -> Producer a m r

Takes a producer of Maybes and filters out the Nothings. Useful for constructing EventSources for producers that don't need to handle every event.

#produce Source

produce :: forall a r eff. ((Either a r -> Eff (avar :: AVAR | eff) Unit) -> Eff (avar :: AVAR | eff) Unit) -> Producer a (Aff (avar :: AVAR | eff)) r

#produce' Source

produce' :: forall a r eff. ((Either a r -> Eff (avar :: AVAR | eff) Unit) -> Eff (avar :: AVAR | eff) (Eff (avar :: AVAR | eff) Unit)) -> Aff (avar :: AVAR | eff) { cancel :: r -> Aff (avar :: AVAR | eff) Boolean, producer :: Producer a (Aff (avar :: AVAR | eff)) r }

#produceAff Source

produceAff :: forall a r eff m. MonadAff (avar :: AVAR | eff) m => ((Either a r -> Aff (avar :: AVAR | eff) Unit) -> Aff (avar :: AVAR | eff) Unit) -> Producer a m r

#produceAff' Source

produceAff' :: forall a r eff. ((Either a r -> Aff (avar :: AVAR | eff) Unit) -> Aff (avar :: AVAR | eff) (Aff (avar :: AVAR | eff) Unit)) -> Aff (avar :: AVAR | eff) { cancel :: r -> Aff (avar :: AVAR | eff) Boolean, producer :: Producer a (Aff (avar :: AVAR | eff)) r }