Sets a function called with (dataElement, { type }) when a button is clicked, before the default handling; type is one of UI.ClickedItemTypes. Stored per instance; buttons without a dataElement do not trigger it.
(dataElement, { type })
type
The click middleware.
instance.UI.setClickMiddleware((dataElement, { type }) => { if (type === instance.UI.ClickedItemTypes.BUTTON) console.log('clicked', dataElement);}); Copy
instance.UI.setClickMiddleware((dataElement, { type }) => { if (type === instance.UI.ClickedItemTypes.BUTTON) console.log('clicked', dataElement);});
Sets a function called with
(dataElement, { type })when a button is clicked, before the default handling;typeis one of UI.ClickedItemTypes. Stored per instance; buttons without a dataElement do not trigger it.