api.intercept()
Description
Allows intercepting and preventing the inner events
Usage
api.intercept(
event: string,
callback: function,
config?: { tag?: number | string }
): 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)config- (optional) an object with extra settings for the callback:tag- (optional) a tag that identifies the callback so it can be removed later via theapi.detach()method
info
Example
// create Booking
const widget = 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
widget.api.intercept("filter-data", data => {
data.time = [{ from: 9, to: 12 }];
});