Handles the registration and deregistration of callback functions for
specific events types.
Methods
-
clear(type)
-
Remove all callback functions that listen for the specified event type.Parameters:
Name Type Description type
String The type of event. -
emit(type, args, sync)
-
Invokes the callback functions for the specified event type.Parameters:
Name Type Description type
String The type of event. args
Object The arguments to match before invoking the callback function. sync
Boolean Whether you want the callback to be executed right away. A value true
indicates to execute the callback immediately upon the event being triggered, otherwise, there's small delay (approximately one millisecond) before the callback is invoked.Returns:
A value oftrue
to indicate that the callback should be called, otherwisefalse
. -
isOn(type)
-
Get an array of event listeners based on the specified event type.Parameters:
Name Type Description type
String The type of event. -
on(type, The, paramMatch)
-
Register a callback function as an event listener for the specified event type. You specify when the callback function is invoked based on a set of matching parameters.Parameters:
Name Type Description type
String The type of event listener. The
function name of the function to call. paramMatch
String The list of function parameters. -
once(type, listener, paramMatch)
-
Register a callback function as an event listener for the specified event type. After the callback function is invoked once, it's removed from the list of event listeners. You specify when the event listener is called based on the matchingparamMatch
parameter.Parameters:
Name Type Description type
String The type of the event listener. listener
function The name of the function to call. paramMatch
Object A list of parameters that are required to invoke the event. -
un(type, callback)
-
Deregister a callback function from being called based on the specified event type.Parameters:
Name Type Description type
String The type of event. callback
function The name of the function to call from the event type.