Class zebkit.Listeners
extends <zebkit.Listener>
<zebkit>

Listeners container class that can be handy to store number of listeners for one type of event.

Constructor:
zebkit.Listeners ([eventName])

Parameters:
  • [eventName] <String>

    an event name the listeners container has been created. By default "fired" is default event name. Event name is used to fire the given event to a listener container.


Example:
 // create container with a default event name
 var  container = new Listeners();

 // register a listener
 var  listener = container.add(function(param1, param2) {
     // handle fired event
 });

 ...
 // fire event
 container.fired(1, 2, 3);

 // remove listener
 container.remove(listener);



public <Function> add (l)

Add listener


Parameters:
Returns: <Function>

a listener that has been registered in the container. The result should be used to un-register the listener

public void remove ([l])

Remove listener or all registered listeners from the container


Parameters:
  • [l] <Function>

    a listener to be removed. If the argument has not been specified all registered in the container listeners will be removed