Event Bus
createEventBus
let createEventBus<'T>(): EventBus<'T>createEmitter
let createEmitter<'T>(): Emitter<'T>createMappedEmitter
let createMappedEmitter<'MessageSchema>(): MappedEmitter<'MessageSchema>See MappedEmitter which is a F# friendly binding.
createEventHub
let createEventHub<'T> (?channels: 'T): EventHub<'T>EventBus
type EventBus<'T> = interfaceProvides all base functions of an event-emitter, plus additional functions for managing listeners.
Its behavior could be customized with a config object. Good for advanced usage.
member listen: ('T -> unit) -> DisposeCallbackThe disposal will be called automatically on cleanup. Use the callback to cleanup the resource earlier if required.
member emit: 'T -> unitmember clear: unit -> unitEmitter
See createEmitter and see createMappedEmitter with the F# friendly
version MappedEmitter
type Emitter<'MessageTyper> = interfaceAn emitter which you can listen to and emit various events.
member on: (string * (obj -> unit)) -> DisposeCallbackThe sub is cleaned up automatically on dismount, but you can cleanup the resource earlier if required.
member emit: (string * obj) -> unitmember clear: unit -> unitMappedEmitter
type MappedEmitter<'MessageMapper> = interfaceThis is a typesafe version of the Emitter made for F#/Fable.
It uses the path from the type to its member as the key of the emission. Because we provide a typed path, we get the benefit of having the member being typed as the message type.
member on (mapping: 'MessageMapper -> 'MessageType) (callback: 'MessageType -> unit) : DisposeCallbackmember emit (mapping: 'MessageMapper -> 'MessageType) (message: 'MessageType) : unitmember clear: unit -> unitGlobalEmitter
type GlobalEmitter<'T> = inherit Emitter<'T>A wrapper around createEmitter. Creates an emitter with which you can listen to and emit various events.
With this emitter you can also listen to all events.
member listen (obj -> unit): DisposeCallbackEventHub
type EventHub<'T> = inherit GlobalEmitter<'T.Provides helpers for using a group of event buses. Can be used with createEventBus, createEventStack or any emitter
with the same api.
Not much more has been bound for this type. I think I was intending to build a type provider for this. Which is a lot of effort for not much worth (to me right now).
Last updated: 7/11/25, 1:35 AM