Skip to main content

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 fired
  • callback - (required) a callback to be performed (the callback 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
});

// every time the filter-data event is triggered, slots will be shown only for the morning time
booking.api.intercept("filter-data", data => {
data.time = [{ from: 9, to: 12 }];
});