Event handling
Attaching event listeners
You can add a custom handler to any event of Sidebar with the sidebar.events.on() method. The method takes the following parameters:
evName | the event name |
evHandler | a custom event handler |
sidebar.events.on("click", function(id,e){
console.log(id);
});
You can attach several handlers to the same event, and Sidebar runs all of them.
note
Event names are case-insensitive.
Related sample: Sidebar. Events
Detaching event listeners
The sidebar.events.detach() method removes an event handler:
sidebar.events.on("click", function(id,e){
console.log(id);
});
sidebar.events.detach("click");
Calling events
The fire() method of the events module calls a custom event:
sidebar.events.fire(evName,[args]);
List of supported events
You can find the full list of Sidebar events in the API section.