Wishlists module
The Wishlists module initializes when the Wishlists application starts. To ensure your code runs when the Wishlists module is ready, use the runIfModuleReady method available immediately after the gwSdkReady event is triggered.
This code ensures the callback runs immediately if the Wishlist module is already initialized; if not, it runs once the module is ready.
function onSdkReady() {
const moduleName = window.gw.sdk.common.constants.modules.WISHLISTS;
window.gw.sdk.runIfModuleReady(moduleName, () => {
// The Wishlists module is ready to use and available at `window.gw.sdk.wishlists`
});
}
if (window.gw && window.gw.sdk) {
onSdkReady();
} else {
document.addEventListener("gwSdkReady", onSdkReady);
}