z_notifier (zotonic_core v1.0.0-rc.10)
Link to this section Summary
Functions
Subscribe once to a notification, detach after receiving the notification.
Unsubscribe from an event.
Detach all observers and delete the event
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, Context)
Do a fold over all observers, prio 1 observers last
List all observers for all events for the site.
Return all observers for a particular event
Call all observers, return the list of answers. The prototype of the observer is: f(Msg, Context)
Async cast the event to the first observer. The prototype of the observer is: f(Msg, Context) -> void
Async cast the event to all observers. The prototype of the observer is: f(Msg, Context) -> void
Notify delayed notifications.
Erase queued notifications
Sync cast the event to all observers. The prototype of the observer is: f(Msg, Context) -> void
Subscribe to an event. Observer is a MFA or pid()
Subscribe to an event. Observer is a MFA or pid()
Link to this section Functions
Link to this function
await(Msg, Context)
-spec await(tuple() | atom(), z:context()) -> {ok, tuple() | atom()} | {ok, {pid(), reference()}, tuple() | atom()} | {error, timeout}.
Link to this function
await(Msg, Timeout, Context)
-spec await(tuple() | atom(), pos_integer(), z:context()) -> {ok, tuple() | atom()} | {ok, {pid(), reference()}, tuple() | atom()} | {error, timeout}.
Link to this function
await_exact(Msg, Context)
-spec await_exact(tuple() | atom(), #context{}) ->
{ok, tuple() | atom()} |
{ok, {pid(), reference()}, tuple() | atom()} |
{error, timeout}.
Link to this function
await_exact(Msg, Timeout, Context)
-spec await_exact(tuple() | atom(), pos_integer(), z:context()) -> {ok, tuple() | atom()} | {ok, {pid(), reference()}, tuple() | atom()} | {error, timeout}.
Link to this function
detach(Event, Context)
Link to this function
detach(Event, OwnerPid, Site)
Link to this function
detach_all(Context)
Link to this function
detach_all(OwnerPid, Site)
Link to this function
first(Msg, Context)
Link to this function
foldl(Msg, Acc0, Context)
Link to this function
foldr(Msg, Acc0, Context)
Link to this function
get_observers(Context)
-spec get_observers(z:context()) -> [{atom(), [{integer(), zotonic_notifier:observer()}]}].
Link to this function
get_observers(Event, Site)
Link to this function
map(Msg, Context)
Link to this function
notify1(Msg, Context)
Link to this function
notify(Msg, Context)
Link to this function
notify_queue(Context)
Link to this function
notify_queue_flush(Context)
Link to this function
notify_sync(Msg, Context)
Link to this function
observe(Event, Observer, Context)
Link to this function
observe(Event, Observer, Priority, Context)
Link to this function
observe(Event, Observer, OwnerPid, Priority, Site)
-spec observe(zotonic_notifier:event(), zotonic_notifier:observer(), pid(), integer(), atom() | z:context()) -> ok | {error, term()}.