Module

Queue

Package
purescript-queue
Repository
athanclark/purescript-queue

#Queue Source

newtype Queue a

#newQueue Source

newQueue :: forall a eff. Eff (channel :: CHANNEL, ref :: REF | eff) (Queue a)

#putQueue Source

putQueue :: forall a eff. Queue a -> a -> Eff (channel :: CHANNEL, ref :: REF | eff) Unit

Signal the listener with a value - note that there can be any number of writers to the queue.

#putManyQueue Source

putManyQueue :: forall a eff. Queue a -> Array a -> Eff (channel :: CHANNEL, ref :: REF | eff) Unit

#onQueue Source

onQueue :: forall a eff. Queue a -> (a -> Eff (channel :: CHANNEL, ref :: REF | eff) Unit) -> Eff (channel :: CHANNEL, ref :: REF | eff) Unit

There should only be one listener at a time per queue - multiple readers would cause a race condition.

#readQueue Source

readQueue :: forall a eff. Queue a -> Eff (ref :: REF | eff) (Array a)

Read the entities in the queue without triggering the onQueue callback.

#takeQueue Source

takeQueue :: forall a eff. Queue a -> Eff (ref :: REF | eff) (Array a)

Take the entities out of the queue without triggering the onQueue callback.