SafariEventTarget Class Reference

Technology area
Safari Extensions
Availability
Available in Safari 5.0 and later.

Overview

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

Tasks

Registering Event Listeners

Methods

addEventListener

Starts listening for the specified type of event.

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.

removeEventListener

Stops listening for the specified type of event.

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.