Common Module
The Common module is the foundation of the Growave SDK, providing essential constants, events, and methods that are immediately available when the SDK starts. This module becomes active as soon as the gwSdkReady event is triggered, allowing you to begin interacting with the SDK right away.
To ensure your code runs as soon as the Common module is ready, you can use the following approach:
function onSdkReady() {
// Access module constants
const availableModules = window.gw.sdk.common.constants.modules;
console.log('Available modules:', availableModules);
// Access RxJS operators
const { map, filter } = window.gw.sdk.common.rxjs;
// Use module constants to check if a module is ready
window.gw.sdk.runIfModuleReady(availableModules.WISHLISTS, () => {
console.log('Wishlists module is ready');
});
}
if (window.gw && window.gw.sdk) {
onSdkReady();
} else {
document.addEventListener("gwSdkReady", onSdkReady);
}