Class zEventTarget

Description

The zEventTarget class is based on the DOM EventTarget interface and is used to provide registration and removal of event listeners on an object and to dispatch of events to that object. This class is not intended to be used by itself, but rather as a superclass for objects needing to support events.

Author:

Nicholas C. Zakas, http://www.nczonline.net/

Version:

1.0

Since:

1.0

Constructor Summary

zEventTarget()
Creates a new instance of zEventTarget.

Method Summary

void addEventListener(String type, Function handler)
Adds an event handler for the given type of event.
boolean dispatchEvent(zEvent event)
Fires an event on the zEventTarget and provides the zEvent object for contextual information about the event.
void removeEventListener(String type, Function handler)
Removes an event handler for the given type of event.

Constructor Detail

zEventTarget

public zEventTarget()

Creates a new instance of zEventTarget.

Method Detail

addEventListener

public void addEventListener(String type, Function handler)

Adds an event handler for the given type of event.

Arguments:


dispatchEvent

public boolean dispatchEvent(zEvent event)

Fires an event on the zEventTarget and provides the zEvent object for contextual information about the event.

Arguments:

Returns:

True if the default event action should take place, false if not.


removeEventListener

public void removeEventListener(String type, Function handler)

Removes an event handler for the given type of event.

Arguments: