Skip to main content

Event Callbacks

Listen for events from the widget by passing callback functions to HypermidWidget.init():

Event Reference

Status Values

The onStatusChange callback receives these status values: Events are communicated via window.postMessage from the iframe. The embed script handles the plumbing automatically.

Programmatic Control

After initialization, control the widget dynamically:

Update Configuration

Rebuild the widget with new settings:
update() rebuilds the iframe URL — this reloads the widget. For runtime changes without reload, use postMessage.

Set Swap Parameters

Change the swap pair and amount without reloading:

Change Theme at Runtime

Override CSS Variables at Runtime

Destroy the Widget

Remove the widget from the DOM and clean up:

Direct postMessage API

If you’re using the direct iframe embed (without embed.js), you can send messages directly:

Listening for Events (Direct Iframe)