Feature Events
React to visibility and preview state changes with show, hide, start, and stop events.
Feature events fire when the widget's visibility or preview mode changes. They carry no payload.
Visibility Events
| Event | String value | When |
|---|---|---|
ON_VISIBILITY_SHOW | visibility:show | Widget becomes visible |
ON_VISIBILITY_HIDE | visibility:hide | Widget becomes hidden |
import { ScenaEvent } from '@retoo/scena';
instance.api.events.on(ScenaEvent.ON_VISIBILITY_SHOW, () => {
console.log('Widget is visible');
});
instance.api.events.on(ScenaEvent.ON_VISIBILITY_HIDE, () => {
console.log('Widget is hidden');
});
Preview Events
| Event | String value | When |
|---|---|---|
ON_PREVIEW_START | preview:start | Preview mode is activated |
ON_PREVIEW_STOP | preview:stop | Preview mode is deactivated |
instance.api.events.on(ScenaEvent.ON_PREVIEW_START, () => {
console.log('Preview started');
});
instance.api.events.on(ScenaEvent.ON_PREVIEW_STOP, () => {
console.log('Preview stopped');
});