Copyright © 2009 Marc Worrell
Behaviours: gen_server.
Authors: Marc Worrell (marc@worrell.nl).
code_change/3 | Convert process state when code is changed. |
detach/3 | Unsubscribe from an event. |
detach_all/2 | Detach all observers and delete the event. |
first/2 | Call all observers till one returns something else than undefined. |
foldl/3 | Do a fold over all observers, prio 1 observers first. |
foldr/3 | Do a fold over all observers, prio 1 observers last. |
get_observers/2 | Return all observers for a particular event. |
handle_call/3 | Return the list of observers for an event. |
handle_cast/2 | Add an observer to an event. |
handle_info/2 | Handle timer ticks. |
init/1 | Initiates the server, creates a new observer list. |
map/2 | Call all observers, return the list of answers. |
notify/2 | Cast the event to all observers. |
notify1/2 | Cast the event to the first observer. |
notify_observer/4 | Notify an observer of an event. |
observe/3 | Subscribe to an event. |
observe/4 | Subscribe to an event. |
start_link/1 | Starts the notification server. |
start_tests/0 | Start a notifier server for unit testing. |
terminate/2 | This function is called by a gen_server when it is about to terminate. |
code_change(OldVsn, State, Extra) -> {ok, NewState}
Convert process state when code is changed
detach(Event, Observer, Context) -> any()
Unsubscribe from an event. Observer is a {M,F} or pid()
detach_all(Event, Context) -> any()
Detach all observers and delete the event
first(Msg, Context) -> any()
Call all observers till one returns something else than undefined. The prototype of the observer is: f(Msg, Context)
foldl(Msg, Acc0, Context) -> any()
Do a fold over all observers, prio 1 observers first. The prototype of the observer is: f(Msg, Acc, Context)
foldr(Msg, Acc0, Context) -> any()
Do a fold over all observers, prio 1 observers last
get_observers(Msg, Context) -> any()
Return all observers for a particular event
handle_call(Message::Request, From, State) -> {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}
Return the list of observers for an event. The event must be an atom.
handle_cast(Message::Msg, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}
Add an observer to an event
handle_info(Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}
Handle timer ticks
init(Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}
Initiates the server, creates a new observer list
map(Msg, Context) -> any()
Call all observers, return the list of answers. The prototype of the observer is: f(Msg, Context)
notify(Msg, Context) -> any()
Cast the event to all observers. The prototype of the observer is: f(Msg, Context) -> void
notify1(Msg, Context) -> any()
Cast the event to the first observer. The prototype of the observer is: f(Msg, Context) -> void
notify_observer(Msg, X2, IsCall, Context) -> any()
Notify an observer of an event
observe(Event, Observer, Context) -> any()
Subscribe to an event. Observer is a {M,F} or pid()
observe(Event, Observer, Priority, Context) -> any()
Subscribe to an event. Observer is a {M,F} or pid()
start_link(SiteProps) -> {ok, Pid} | ignore | {error, Error}
Starts the notification server
start_tests() -> any()
Start a notifier server for unit testing
terminate(Reason, State) -> void()
This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.
Generated by EDoc, Feb 25 2011, 21:14:41.