DOM Events
Use DOM events to respond to user submissions directly in JavaScript.
If you need to respond to a user submission in your frontend JavaScript logic directly, we offer the option to emit a custom DOM event for you to subscribe to. You can set the name of the window event yourself in the EasePop editor. Select the "Elements" tab and under "Form Submission" enter a custom event name.
Use a snippet like this to listen to the event in your frontend.
type EasePopEventPayload = {
domain: string;
formData: Record<string, string | number | boolean>;
popupId: string;
timestamp: string; // ISO-String
};
const eventName = "your-event-name";
function handler(event: CustomEvent<EasePopEventPayload>) {
const payload = event.detail;
}
window.addEventListener(eventName, handler);