Skip to main content

Gift Registry module

The Gift Registry module initializes when the Gift Registry application starts. To ensure your code runs when the Gift Registry module is ready, use the runIfModuleReady method available immediately after the gwSdkReady event is triggered.

This code ensures the callback runs immediately if the Gift Registry module is already initialized; if not, it runs once the module is ready.

function onSdkReady() {
const moduleName = window.gw.sdk.common.constants.modules.GIFT_REGISTRY;

window.gw.sdk.runIfModuleReady(moduleName, () => {
// The Gift Registry module is ready to use and available at `window.gw.sdk.gift_registry`
});
}

if (window.gw && window.gw.sdk) {
onSdkReady();
} else {
document.addEventListener("gwSdkReady", onSdkReady);
}