Verona Widget Interface Handles communication between widget and host application.

// 1. Instantiate
const widget = new VeronaWidgetApiService({ debug: true });

// 2. Optionally register handler for start command BEFORE sendReady()
// (not all widgets require a start command)
widget.onStartCommand((cmd) => {
restoreState(cmd.state);
});

// 3. Announce readiness
widget.sendReady({ metadata: JSON.stringify(meta) });

// 4. Optionally send intermediate state changes
widget.sendStateChanged(state, sharedParameters);

// 5. Request closing the widget dialog (save or cancel)
widget.sendReturnRequested(state, sharedParameters, saveState);

// 6. Cleanup (e.g. in ngOnDestroy)
widget.destroy();

Constructors

Properties

messageHandlers: Map<string, Set<Function>> = ...
sessionId: null | string = null
debug: boolean
allowedOrigin: string
targetWindow: Window
messageListener: ((event: MessageEvent<any>) => void)

Methods

  • Send vowReadyNotification to the host. Call this after registering all handlers (especially onStartCommand).

    After this notification the host may send a vowStartCommand – but this is not guaranteed. Some widgets (e.g. a static display) do not require a start command to function.

    Parameters

    Returns void

  • Send vowStateChangedNotification to the host whenever the widget state changes.

    Sending this notification is optional – it is only useful when intermediate save-points are desired (e.g. for logging). The host uses timeStamp to establish the correct ordering of asynchronously arriving messages.

    Requires an active session (i.e. onStartCommand must have fired with a sessionId).

    Parameters

    • Optionalstate: string

      Serialised widget state (string). Format is widget-specific.

    • OptionalsharedParameters: MainSchema.SharedParameter[]

      Optional shared parameters

    Returns void

  • Send vowReturnRequested to the host to request closing the widget dialog.

    Requires an active session (i.e. onStartCommand must have fired with a sessionId).

    Parameters

    • Optionalstate: string

      Serialised widget state (string). Format is widget-specific.

    • OptionalsharedParameters: MainSchema.SharedParameter[]

      Optional shared parameters

    • saveState: boolean = true

      Controls whether the state changes should be applied (saved) by the host, or discarded. true means "save & close", false means "cancel / close without saving". Default: true

    Returns void

  • Register a handler for vowStartCommand.

    Registering this handler is optional – not all widgets require a start command (e.g. a static display with no data dependency). When a command arrives, the session ID (if present) is stored automatically before your callback is invoked.

    Register this handler before calling sendReady().

    Parameters

    Returns void