api.on()
Description
Allows attaching a handler to the inner events
Usage
api.on(
event: string,
handler: function
): void;
Parameters
event
- (required) an event to be firedhandler
- (required) a handler to be attached (the handler arguments will depend on the event to be fired)
info
The full list of the Booking internal events you can find here.
Use the api.on()
method if you want to listen to the actions without modifying them. To make changes to the actions, apply the api.intercept()
method.
Example
// create Booking
const booking = new booking.Booking("#root", {
data,
// other configuration parameters
});
// output the selected slot id and time
booking.api.on("select-slot", (obj) => {
console.log("The selected slot", obj.id, "and time", obj.time);
});