event_bus v0.2.0 EventBus

Simple event bus implementation.

Link to this section Summary

Functions

Send event to all listeners

Subscribe to the bus

List the subscribers to the bus

Unsubscribe from the bus

Link to this section Functions

Link to this function notify(event)
notify({:atom, any}) :: :ok

Send event to all listeners.

Examples

EventBus.notify({:webhook_received, %{"message" => "Hi all!"}})
:ok
Link to this function subscribe(listener)
subscribe(any) :: :ok

Subscribe to the bus.

Examples

EventBus.subscribe(MyEventListener)
:ok
Link to this function subscribers()
subscribers() :: [any]

List the subscribers to the bus.

Examples

EventBus.subscribers()
[MyEventListener]
Link to this function unsubscribe(listener)
unsubscribe(any) :: :ok

Unsubscribe from the bus.

Examples

EventBus.unsubscribe(MyEventListener)
:ok