PublicShow sourcebroadcast.pl -- Event service

Generic broadcasting service. Broadcasts are made using the predicate broadcast(+Templ). All registered `listeners' will have their goal called. Success or failure of this is ignored. The listener can not bind arguments.

This library is particularly useful for disconnecting modules in an application. Modules can broadcast events such as changes, anticipating other modules need to react on such changes. For example, settings.pl broadcasts changes to settings, allowing dependent modules to react on changes:

:- listen(setting(changed(http:workers, New)),
          change_workers(New)).

change_workers(New) :-
        setting(http:port, Port),
        http_workers(Port, New).
Source listen(+Listener, +Templ, :Goal) is det
Source listen(+Templ, :Goal) is det
Open a channel for listening for events of the given `Templ'.

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source unlisten(Arg1, Arg2)
Source broadcast(Arg1)
Source unlisten(Arg1)
Source broadcast_request(Arg1)
Source unlisten(Arg1, Arg2, Arg3)
Source listening(Arg1, Arg2, Arg3)