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 still be loaded on the page.
The API uses the original mode identifiers: "scratch" is Sandbox mode and "closet" is Bundle mode.

Opening

HemsyEmbed.open("instant", ...) only works when the embed is configured with instant mode — data-hemsy-mode="instant" on the script tag or mode: "instant" on HemsyEmbedConfig. Without it, the instant parameters are not forwarded and the modal opens as a plain embed. Conversely, with instant mode set, HemsyEmbed.open("share", ...) will not work — see Launch modes.

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.