跳到主要内容

api.setNext()

描述

将自定义处理程序添加到 widget Event Bus 链的末尾

用法

api.setNext(next: any): void;

参数

  • next - (必填)要加入 Event Bus 顺序的操作

示例

以下示例演示如何使用 api.setNext() 方法将自定义类集成到 Event Bus 顺序中:

const widget = 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) => {
widget.setConfig({data});
});
// Integrate someServerService into the Event Bus order of the widget
widget.api.setNext(someServerService);

相关文章加载数据