Event Handling

Attaching event listeners

You can add any handler to the events of Toolbar. To do this, use the toolbar.events.on() method with the following parameters:

  • evName - the name of the event
  • evHandler - a user-defined event handler
toolbar.events.on("Click", function(id,e){
    console.log(id);
});

Several handlers can be attached to one and the same event, and all of them will be executed.

The names of the events are case-insensitive.

Detaching event listeners

There is a simple way of removing an event handler with the toolbar.events.detach() method:

toolbar.events.on("Click", function(id,e){
    console.log(id);
});
 
toolbar.events.detach("Click");

Calling events

A custom event can be called with the fire() method of the events module:

toolbar.events.fire(evName,[args]);

List of supported events

You can find the full list of toolbar events in the API section.

Back to top