Module ce_event

Description

Super-simple generic synchronous event handler.

This module differs from gen_event in several significant ways:

  • each event handler is a fun/2
  • and is passed the arguments and state given to notify
  • each event (class, not instance) must have a unique name (event id)
  • fully synchronous (every event handler is executed in the process that causes the event)
  • each event is executed in order of its priority
  • each event handler can cancel all subsequent events and immediately return a value to the cause of the event

Event handlers are passed the state, initially given by the cause of the event. Each handler may return:

  • {ok, NewState} to change the state and continue processing this event with other handlers;
  • {done, NewState} to change the state and cancel the processing of the other handlers; or
  • {error, Error} to indicate an error occurred.

Function Index

Exported Functions
add_handler/4
add_handlers/2
new_manager/1
notify/4
test/0

Exported Functions

add_handler/4

add_handler(Arg1, Arg2, Arg3, Arg4) -> term()

add_handlers/2

add_handlers(Arg1, Arg2) -> term()

new_manager/1

new_manager(Arg1) -> term()

notify/4

notify(Arg1, Arg2, Arg3, Arg4) -> term()

test/0

test() -> term()