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 typeString The type of event. -
emit(type, args, sync)
-
Invokes the callback functions for the specified event type.Parameters:
Name Type Description typeString The type of event. argsObject The arguments to match before invoking the callback function. syncBoolean Whether you want the callback to be executed right away. A value trueindicates 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 oftrueto 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 typeString 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 typeString The type of event listener. Thefunction name of the function to call. paramMatchString 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 matchingparamMatchparameter.Parameters:
Name Type Description typeString The type of the event listener. listenerfunction The name of the function to call. paramMatchObject 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 typeString The type of event. callbackfunction The name of the function to call from the event type.