Skip to main content

Event handling

Attaching event listeners​

You can add a custom handler to any event of Toolbar with the toolbar.events.on() method. The method takes the following parameters:

evNamethe event name
evHandlera custom event handler

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

You can attach several handlers to the same event, and Toolbar runs all of them.

note

Event names are case-insensitive.

Related sample: Toolbar. Events

Detaching event listeners​

The toolbar.events.detach() method removes an event handler:

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

toolbar.events.detach("click");

Calling events​

The fire() method of the events module calls a custom event:

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

List of supported events​

The API section lists all Toolbar events.