Event handling
Attaching event listeners
You can add any handler to the events of Menu. To do this, use the menu.events.on() method with the following parameters:
evName | name of the event |
evHandler | user-defined event handler |
menu.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.
note
The names of the events are case-insensitive.
Related sample: Menu. Events
Detaching event listeners
There is a simple way of removing an event handler with the menu.events.detach() method:
menu.events.on("click", function(id, e){
console.log(id);
});
menu.events.detach("click");
Calling events
A custom event can be called with the fire() method of the events module:
menu.events.fire(evName,[args]);
List of supported events
You can find the full list of Menu events in the API section.