Handles registering events and calling the event handlers. The event register is a hierarchical list with the following format: Raising class -> Event -> Catching class -> Callback type -> Function The first three elements should be self explanatory, as should the function name. The callback type, however, represents how the function will be called. The valid types are "instance" and "static", the difference being that an instance of the class is not created for "static" callbacks.
Note that this presupposes that all events are raised and caught by a class, but this is not an absolute requirement. For either type of callback function, if the catching class does not exist (i.e. the callback was directly registered using a dumby name), the event will be raised as a regular function.
function isEvent( |
| ) |
Check if an event exists.
raising_class | The name of the class that this event belongs to. |
name | The name of the event. |
True if the event exists, false if it does not.
function hasHandlers( |
| ) |
Check if a given event has any handlers registered.
raising_class | The name of the class that this event belongs to. |
name | The name of the event. |
True if the event has one or more handlers registered, false if it does not.
function addEvent( |
| ) |
Creates a new event.
raising_class | The name of the class that this event belongs to, i.e. the class that will raise it. |
name | The name of the event. |
False if the event already exists, true otherwise.
function addHandler( |
| ) |
Adds a handler function to an event. If the event does not already exist, then it is created.
raiseing_class | The name of the class that will raise the event. |
name | The name of the event. |
catching_class | The name of the class to which the event handler belongs. |
handler | The name of the function (presumably a member function of the catching class, but not necessarily) that will handle this event. |
static | Optional boolean parameter determing whether the method is static, i.e. does not need an instance of the class to work. Defaults to false (instance method). |
function activateEventFull( |
| ) |
Raises an arbitrary event for the given class.
param | An arbitrary object that is passed by reference to the event handlers. |
raisecls | The name of the class the event belongs to. |
event | The name of the event. |
data | An optional array of data parameters for the event handler. |
False if the event does not exist, true otherwise.
function activateEvent( |
| ) |
Activates an event for the raising object.
raiser | The object which is raising the event. This is passed by reference to the event handler. |
event | The name of the event. |
params | An optional array of parameters to pass to the event handler. |
False if the event does not exist, true otherwise.