Safari Developer Library

Developer

SafariEventTarget Class Reference

Options
Deployment Target:

On This Page

SafariEventTarget

The SafariEventTarget class serves as a base class for all objects that participate in the event-dispatch hierarchy.

  • Starts listening for the specified type of event.

    Declaration

    void addEventListener(in DOMString type, in SafariEventListener listener, in boolean useCapture);

    Parameters

    type

    The type of event to listen for.

    listener

    The function to call when the event occurs.

    useCapture

    Pass true if you want to listen during the capturing phase; otherwise, false.

    Discussion

    For the string used to identify the type of an event, see the reference for the class used to represent that event.

  • Stops listening for the specified type of event.

    Declaration

    void removeEventListener(in DOMString type, in SafariEventListener listener, in boolean useCapture);

    Parameters

    type

    The type of event to listen for.

    listener

    The function to call when the event occurs.

    useCapture

    Pass true if you want to listen during the capturing phase; otherwise, false.

    Discussion

    For the listener to be removed, the parameters must be exactly the same as the parameters that were passed to addEventListener to add the listener.