DOM Events
Listen to scena:mount and scena:unmount events on the custom element via addEventListener.
The custom element dispatches two events on the DOM element itself. Both bubble and cross shadow DOM boundaries (composed: true).
scena:mount
Fires after .mount() completes. The ScenaInstance is available in event.detail:
el.addEventListener('scena:mount', (event) => {
const instance = event.detail;
instance.visibility.show();
});
scena:unmount
Fires after .unmount() completes or when the element is removed from the DOM. No detail payload:
el.addEventListener('scena:unmount', () => {
console.log('Widget unmounted');
});
Event summary
| Event | Fires when | event.detail |
|---|---|---|
scena:mount | Widget is mounted inside the element | ScenaInstance |
scena:unmount | Widget is unmounted or element is removed from DOM | — |