Skip to main content
If you’d rather open Hemsy from JavaScript than from launcher attributes (for dynamic elements, custom routing, or your own event handling), use window.HemsyEmbed. The embed script must be loaded on the page — either install path works, since the theme extension and the script install load the same script.
The API uses the original mode identifiers: "scratch" is Sandbox mode and "closet" is Bundle mode.

Opening

Every call resolves its own mode and action: instant opens work without any script-level configuration, and instant and share opens coexist on the same page. Passing action in the payload overrides the page-level data-hemsy-action for that open only.

Closing

Configuration with HemsyEmbedConfig

window.HemsyEmbedConfig is the JavaScript alternative to script-tag data attributes, and the only place to register event callbacks. Define it before the embed script loads:
When the same setting appears both on HemsyEmbedConfig and as a script-tag data attribute, the script attribute wins. Keep each setting in one place to avoid surprises.