EventListener procedures

EventListener procedures are used to perform custom actions in reaction to Server Events.

A procedure of this type has the following structure:

Listing 213 Structure of EventListener procedures
1
2
3
4
5
  var listeners = {
      "EventName1": function(context, event) {},
      "EventName2": function(context, event) {},
      ...
  };

Important

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 Procedures

To configure an EventListener procedure, you must first create a Event-listener-procedure containing the script itself, then link to it 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.

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 sub-type of it.

function(context, event)

Implementation of an event listener.

param context:The context object for event-listener-procedures
param event:The event object, which will be of the type listened for or one of its sub-types.
returns:nothing