Zapatec.EventDriven

Overview | File | Class | Tree | Index | Help

Zapatec Utils

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class Zapatec.EventDriven

    Object
       |
       +--Zapatec.EventDriven

Direct Known Subclasses:
  Zapatec.Widget

class Zapatec.EventDriven

Defined in zpeventdriven.js

Constructor Summary
`Zapatec.EventDriven()` Base event-driven class.

Method Summary
`Object` | `addEventListener(<string> sEv, <function> fLsnr)` Adds event listener to the end of list.
`void` | `fireEvent(<string> sEv)` Fires event.
`object` | `getEventListeners(<string> sEv)` Returns array of listeners for the specified event.
`boolean` | `isEvent(<string> sEv)` Checks if the event exists.
`boolean` | `isEventListener(<string> sEv, <function> fLsnr)` Checks if the event listener is attached to the event.
`void` | `removeEvent(<string> sEv)` Removes all listeners for the event.
`number` | `removeEventListener(<string> sEv, <function> fLsnr)` Removes event listener.
`Object` | `unshiftEventListener(<string> sEv, <function> fLsnr)` Adds event listener to the beginning of list.

Constructor Detail

### Zapatec.EventDriven

    Zapatec.EventDriven()

Base event-driven class.

Method Detail

### addEventListener

    Object addEventListener(<string> sEv, <function> fLsnr)

Adds event listener to the end of list.

     If multiple identical event listeners are registered on the same event, the
     duplicate instances are discarded. They do not cause the event listener to be
     called twice, and since the duplicates are discarded, they do not need to be
     removed manually with the removeEventListener method.

     Synopsis:

     oEventDriven.addEventListener('eventName', fEventListener);

     There is also static method doing the same with global events:

     Zapatec.EventDriven.addEventListener('globalEventName', fEventListener);

Parameters:

`sEv` - Event name

`fLsnr` - Event listener

### fireEvent

    void fireEvent(<string> sEv)

Fires event. Takes in one mandatory argument sEv and optionally any number of other arguments that should be passed to the listeners.

     Synopsis:

     oEventDriven.fireEvent('eventName');

     There is also static method doing the same with global events:

     Zapatec.EventDriven.fireEvent('globalEventName');

Parameters:

`sEv` - Event name

### getEventListeners

    object getEventListeners(<string> sEv)

Returns array of listeners for the specified event.

     Synopsis:

     oEventDriven.getEventListeners('eventName');

     There is also static method doing the same with global events:

     Zapatec.EventDriven.getEventListeners('globalEventName');

Parameters:

`sEv` - Event name

Returns:

Array of function references

### isEvent

    boolean isEvent(<string> sEv)

Checks if the event exists.

     Synopsis:

     oEventDriven.isEvent('eventName');

     There is also static method doing the same with global events:

     Zapatec.EventDriven.isEvent('globalEventName');

Parameters:

`sEv` - Event name

Returns:

Exists

### isEventListener

    boolean isEventListener(<string> sEv, <function> fLsnr)

Checks if the event listener is attached to the event.

     Synopsis:

     oEventDriven.isEventListener('eventName', fEventListener);

     There is also static method doing the same with global events:

     Zapatec.EventDriven.isEventListener('globalEventName', fEventListener);

Parameters:

`sEv` - Event name

`fLsnr` - Event listener

Returns:

True if event listener is attached to the event

### removeEvent

    void removeEvent(<string> sEv)

Removes all listeners for the event.

     Synopsis:

     oEventDriven.removeEvent('eventName');

     There is also static method doing the same with global events:

     Zapatec.EventDriven.removeEvent('globalEventName');

Parameters:

`sEv` - Event name

### removeEventListener

    number removeEventListener(<string> sEv, <function> fLsnr)

Removes event listener.

     Synopsis:

     oEventDriven.removeEventListener('eventName', fEventListener);

     There is also static method doing the same with global events:

     Zapatec.EventDriven.removeEventListener('globalEventName', fEventListener);

Parameters:

`sEv` - Event name

`fLsnr` - Event listener

Returns:

Number of listeners removed

### unshiftEventListener

    Object unshiftEventListener(<string> sEv, <function> fLsnr)

Adds event listener to the beginning of list. Note that there is no guarantee that it will be always first in the list. It will become second once this method is called again. Never rely on that!

     If multiple identical event listeners are registered on the same event, the
     duplicate instances are discarded. They do not cause the event listener to be
     called twice, and since the duplicates are discarded, they do not need to be
     removed manually with the removeEventListener method.

     Synopsis:

     oEventDriven.unshiftEventListener('eventName', fEventListener);

     There is also static method doing the same with global events:

     Zapatec.EventDriven.unshiftEventListener('globalEventName', fEventListener);

Parameters:

`sEv` - Event name

`fLsnr` - Event listener

Overview | File | Class | Tree | Index | Help

Zapatec Utils

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Documentation generated by JSDoc on Thu Aug 16 12:18:39 2007