注册事件处理程序
- 语法
-
bst.event.on(type, handler) - 参数
-
参数名 指定的值 说明 type 字符串或字符串数组 指定要绑定事件处理程序的事件类型或事件类型数组。
handler 函数 事件发生时执行的处理程序。
在事件处理程序中return Promise对象时,会等待异步处理完成后再开始下一个处理。
- 返回值
- 无。
- 示例
-
(() => { "use strict"; const handler = (event) => { console.log(event); }; bst.event.on('bst.view.load', handler); })();