EventListener procedures#
EventListener procedures are used to perform custom actions in reaction to
A procedure of this type has the following structure:
var listeners = {
"EventName1": function(context, event) {},
"EventName2": function(context, event) {},
...
};
The listeners variable must be a JS object where each entry has a key naming the
Event
to be listened for, and the value being the function that will run in reaction to the event occurring.
See Event for a complete list of which events can be listened for.
Configuring EventListener Script Procedures#
To configure an EventListener script procedure, first create a
Event-listener-procedure
containing the script itself. Then, the script procedure needs to be referenced from an Event-listener instance.
Notice that merely creating a procedure is not enough for the event-listener to become active. It must be added to
the list of event-listener-procedures to become active.
This last step can be accomplished via the Admin UI
Admin UI → System → Event Listeners
Common API#
EventListener procedures have access to all of the Common Procedure API .
EventListener functions#
Each listener function takes two arguments: the context object, as well as the event itself.
The context has type EventListenerProcedureContext.
The event will be of the type the function listens for, or a subtype of it.
function(context, event)#
Implementation of an event listener.
Parameters:
context- The context object for event-listener-proceduresevent- The event object, which will be of the type listened for or one of its subtypes.
Returns: nothing