Events
The widget and web components inside skills emit CustomEvents. This is the main way to react to user actions from skill code and external integrations.
EVENT
parsewise:language-change
Fires on the drawer root when the widget language changes. detail contains the new locale code.
const host = document.querySelector('parsewise-widget')?.shadowRoot?.host
host?.addEventListener('parsewise:language-change', (e) => {
console.log('Language →', e.detail.language) // 'ru' | 'en' | ...
})
EVENT
action
Fired when [data-action] without href is clicked inside a skill. detail contains { action, value }.
host.addEventListener('action', (e) => {
const { action, value } = e.detail
if (action === 'submit') saveSize(value)
})
EVENT
radio-change
[data-radio-switch] changed. detail.value is the new value.
EVENT
suggest-select
User picked a suggestion from [data-suggest-input]. detail contains the selected suggestion object.
EVENT
grid-select / select-list-change
Events for grids and select-lists inside skills. detail describes the selected item.
Example: subscribing from host page
// Wait until widget creates Shadow DOM
const waitForHost = () =>
new Promise((resolve) => {
const tick = () => {
const host = document.querySelector('parsewise-widget')
if (host && host.shadowRoot) return resolve(host)
setTimeout(tick, 100)
}
tick()
})
waitForHost().then((host) => {
host.addEventListener('action', (e) => {
console.log('Skill action:', e.detail)
})
})