Built-in Event Management
The API provides a built-in event management system that helps you manage and trigger custom events in forms. These events can be used for component communication, state management, triggering dynamic behavior, and more.
Trigger Event
The bus.$emit method manually triggers a specified event and can pass multiple parameters. These parameters are passed as arguments to the event handler.
typescript
type emit = (event:string, ...args:any[]) => void- Example:
js
api.bus.$emit('custom-event', 'param1', 'param2');Listen to Event
The bus.$on method listens for specified events. When an event is triggered, the registered callback function executes. You can listen for one or more events.
typescript
type on = (event: string, callback: Function) => void- Example:
js
api.bus.$on('custom-event', (param1, param2) => {
console.log('Event triggered:', param1, param2);
});Listen to One-Time Event
The bus.$once method listens for a specified event, but the callback function executes only once. After execution, the listener is automatically removed.
typescript
type on = (event: string, callback: Function) => void- Example:
js
api.bus.$once('init-complete', () => {
console.log('Initialization complete, event triggered only once');
});Remove Event Listener
The bus.$off method removes listeners for specified events.
typescript
type off = (event: string, callback: Function) => void- Example:
js
api.bus.$off('custom-event', handleCustomEvent);

