Module Stream.Event

Event hubs. On those, handlers can be registered and will be called each time a new event is emitted.

type 'a t = ('a -> unit) list Stdlib.ref

An event hub.

val create : unit -> 'a t

Create an event hub.

val register : 'a t -> ('a0 -> unit) -> unit

Register a handler on the hub.

val emit : 'a t -> 'a0 -> unit

Emit an event.

val emitter : 'a t -> 'b list -> unit t

Stream which emits lists of events.

val merge : 'a list Stdlib.ref -> 'a list Stdlib.ref -> 'a list Stdlib.ref

Merge two hubs.

val forward : 'a t -> 'b t -> unit

Forwrad the events of a hub to a second one.

val may_map : ('a -> 'b option) -> 'c t -> unit