zotonic_notifier_worker (zotonic_notifier v1.0.0-rc.12)
Link to this section Summary
Functions
Subscribe once to a notification, detach after receiving the notification.
Convert process state when code is changed
Unsubscribe an owner-pid from an event.
Detach all observers for the owner
Call all observers till one returns something else than undefined. The prototype of the observer is: f(Msg, Context)
Do a fold over all observers, prio 1 observers first. The prototype of the observer is: f(Msg, Acc, ContextArg)
Do a fold over all observers, prio 1 observers last
Return all observers
Return all observers for a particular event
Add an observer to an event
Trap unknown casts
Handling all non call/cast messages
Initiates the server, creates a new observer list
Call all observers, return the list of answers. The prototype of the observer is: f(Msg, ContextArg)
Cast the event to the first observer. The prototype of the observer is: f(Msg, Context) -> void
Cast the event to all observers. The prototype of the observer is: f(Msg, Context) -> void
Notify an observer of an event
Cast the event to all observers. The prototype of the observer is: f(Msg, Context) -> void
Subscribe to an event. Observer is a {M,F} or pid()
Starts the notification server
Start a notifier server for unit testing
Link to this section Functions
Link to this function
await(Notifier, Event, Msg, Timeout)
-spec await(zotonic_notifier:notifier(), zotonic_notifier:event(), atom() | tuple(), pos_integer()) -> {ok, tuple() | atom()} | {ok, {pid(), reference()}, tuple() | atom()} | {error, timeout}.
Link to this function
await_exact(Notifier, Event, Msg, Timeout)
-spec await_exact(zotonic_notifier:notifier(), zotonic_notifier:event(), term(), pos_integer()) -> {ok, term()} | {ok, {pid(), reference()}, term()} | {error, timeout}.
Link to this function
code_change(OldVsn, State, Extra)
-spec code_change(term(), #state{}, term()) -> {ok, #state{}}.
Link to this function
detach(Notifier, Event, OwnerPid)
-spec detach(zotonic_notifier:notifier(), zotonic_notifier:event(), pid()) -> ok | {error, term()}.
Link to this function
detach_all(Notifier, OwnerPid)
-spec detach_all(zotonic_notifier:notifier(), pid()) -> ok | {error, term()}.
Link to this function
first(Notifier, Event, Msg, ContextArg)
Link to this function
foldl(Notifier, Event, Msg, Acc0, ContextArg)
Link to this function
foldr(Notifier, Event, Msg, Acc0, ContextArg)
Link to this function
get_observers(Notifier)
-spec get_observers(zotonic_notifier:notifier()) -> list().
Link to this function
get_observers(Notifier, Event)
-spec get_observers(zotonic_notifier:notifier(), zotonic_notifier:event()) -> list().
Link to this function
handle_call(Message, From, State)
Link to this function
handle_cast(Message, State)
Link to this function
handle_info(Info, State)
Link to this function
init(Name)
-spec init(atom()) -> {ok, #state{}}.
Link to this function
map(Notifier, Event, Msg, ContextArg)
Link to this function
notify1(Notifier, Event, Msg, ContextArg)
Link to this function
notify_async(Notifier, Event, Msg, ContextArg)
Link to this function
notify_observer(Msg, _, IsCall, ContextArg)
Link to this function
notify_sync(Notifier, Event, Msg, ContextArg)
Link to this function
observe(Notifier, Event, Observer, OwnerPid, Prio)
-spec observe(zotonic_notifier:notifier(), zotonic_notifier:event(), zotonic_notifier:observer(), pid(), integer()) -> ok | {error, term()}.
Link to this function
start_link(Name)
-spec start_link(Name :: atom()) -> {ok, pid()} | {error, term()}.
Link to this function
start_tests()
-spec start_tests() -> {ok, pid()} | {error, term()}.
Link to this function
terminate(Reason, State)
-spec terminate(term(), #state{}) -> ok.