Module

Toestand.Watches

Package
purescript-toestand
Repository
garganscript/purescript-toestand

Manages a collection of listeners which can be selectively notified of changes to a value.

#Watches Source

data Watches a

Constructors

#watches Source

watches :: forall a. Watches a

Create a new Watches from a should notify predicate.

#listen Source

listen :: forall a. Listener a -> Watches a -> (Tuple Int (Watches a))

Add a change listener effect. Returns a key that can be used to unlisten along with modified watches.

#notify Source

notify :: forall a. Watches a -> Change a -> Effect (Change a)

Call back all the listeners with a change

#unlisten Source

unlisten :: forall a. Watches a -> Int -> Watches a

Remove the provided