Skip to main content

Event handling

Attaching event listeners​

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

evNamethe event name
evHandlera custom event handler

tabbar.events.on("afterClose", function(id){
console.log(id);
});

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

note

Event names are case-insensitive.

Related sample: Tabbar. Events

Detaching event listeners​

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

tabbar.events.on("afterClose", function(id){
console.log(id);
});

tabbar.events.detach("afterClose");

Calling events​

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

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

List of supported events​

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