ToiEventTarget Interface Reference
Description
ToiEventTarget is a base interface that allows applications to add and remove event listeners for specific events. In JavaScript an event listener is implemented with a function that takes a single argument of type ToiEvent or a type derived from ToiEvent depending on the specific event.
- See also:
- ToiEvent, ToiEventListener
import "ToiEventTarget.idl";
List of all members.
Member Function Documentation
This method registers an event listener for a specific event. Multiple listeners can be added for the same event. Events are broadcast to all registered listeners.
- Parameters:
-
| type | The event type of the event to subscribe to. |
| listener | The JavaScript function that will receive events. |
- Exceptions:
-
| TInvalidArgumentException | Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the application calls addEventListener with the same combination of type and listener twice. |
This method removes an event listener for a specific event.
- Parameters:
-
| type | The event type of the event to remove the listener from. |
| listener | The JavaScript function that was previously added as an event listener. |
- Exceptions:
-
| TInvalidArgumentException | Raised if the event type is not supported by this object or if the listener is not a valid JavaScript function. This exception is also raised if the listener had not previously been added. |