Register an event handler
- Syntax
-
bst.event.on(type, handler) - Parameters
-
Parameter Value Description type String or array of strings Specify the event type, or an array of event types, to which the event handler is bound.
handler Function The handler that runs when the event occurs.
If you return a Promise object in the event handler, the next process starts after the asynchronous process is complete.
- Return value
- None.
- Sample
-
(() => { "use strict"; const handler = (event) => { console.log(event); }; bst.event.on('bst.view.load', handler); })();