0.0.2

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

EventString valueWhen
ON_VISIBILITY_SHOWvisibility:showWidget becomes visible
ON_VISIBILITY_HIDEvisibility:hideWidget 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

EventString valueWhen
ON_PREVIEW_STARTpreview:startPreview mode is activated
ON_PREVIEW_STOPpreview:stopPreview 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');
});