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.

Conforms To


Not Applicable

Import Statement


Not Applicable Not Applicable

Availability


Available in Safari 5.0 and later.
  • Starts listening for the specified type of event.

    Declaration

    JavaScript

    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.

    Availability

    Available in Safari 5.0 and later.

  • Stops listening for the specified type of event.

    Declaration

    JavaScript

    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.

    Availability

    Available in Safari 5.0 and later.