api.intercept()
Description
Allows intercepting and preventing the inner events
Usage
api.intercept(
event: string,
callback: function
): void;
Parameters
event
- (required) an event to be firedcallback
- (required) a callback to be performed (the callback arguments will depend on the event to be fired)
Events
info
The full list of the Booking internal events can be found here
Example
// create Booking
const booking = new booking.Booking("#root", {
cards,
cardShape
});
// every time the set-filter event is triggered, the time field will contain only the morning time
booking.api.intercept("set-filter", data => {
data.filterData.time = [{ start: 9, end: 12 }];
return data;
});