api.setNext()
Description
Allows adding some action into the Event Bus order
Usage
api.setNext(next: any): void;
Parameters
next
- (required) the action to be included into the Event Bus order
Example
The example below shows how to use the api.setNext()
method to integrate some custom class into the Event Bus order:
const booking = new booking.Booking("#root", { data: [] });
const server = "https://some-backend-url";
// Assume you have a custom server service class named someServerService
const someServerService = new ServerDataService(server);
fetch(server + "/data").then((res) => res.json()).then((data) => {
booking.setConfig({data});
});
// Integrate the serverDataService into the Event Bus order of widget
booking.api.setNext(someServerService);
Related articles: Loading data