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 m f. EventSource f m -> m { done :: m Unit, producer :: Producer (f SubscribeStatus) m Unit }

#interpret Source

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

#hoist Source

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

#eventSource Source

eventSource :: forall a m f. MonadAff m => ((a -> Effect Unit) -> Effect 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 a m f. MonadAff m => ((a -> Effect Unit) -> Effect (Effect 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 m f. MonadAff m => (Effect Unit -> Effect 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 m f. MonadAff m => (Effect Unit -> Effect (Effect 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 r a m. 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 r a. ((Either a r -> Effect Unit) -> Effect Unit) -> Producer a Aff r

#produce' Source

produce' :: forall r a. ((Either a r -> Effect Unit) -> Effect (Effect Unit)) -> Aff { cancel :: r -> Aff Boolean, producer :: Producer a Aff r }

#produceAff Source

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

#produceAff' Source

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