Class zebkit.Listeners
extends <zebkit.Listener>

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

zebkit.Listeners ([eventName])

  • [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.

 // 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

public <Function> add (l)

Add listener

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

  • [l] <Function>

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