03.06.2026, 13:28
This example adds a confirmation to the switch widget.
Change widgetId value to your switch widget ID. ID is shown in the window title when editing a widget.
Change widgetId value to your switch widget ID. ID is shown in the window title when editing a widget.
Code:
const widgetId = 26
Visu.on('widget-ready', widgetId, ({ widget }) => {
const component = widget.component
const handler = component.compactModeClick
component.compactModeClick = () => {
Visu.emitter.emit('confirm-dialog-show', {
text: 'Are you sure?',
callback: handler
})
}
})
