Skip to main content

openReviewsDrawer

This method attempts to open the Reviews drawer.

Usage example​

Ensure the SDK is ready, the ReviewsDrawerWidget is injected, and the ReviewsSdk module is ready:

function onSdkReady() {
const eventName = window.gw.sdk.common.events.WIDGET_INJECTED;
window.gw.sdk.on(eventName, (event) => {
if (event.detail.widgetName === "ReviewsDrawerWidget") {
const moduleName = window.gw.sdk.common.constants.modules.REVIEWS;
window.gw.sdk.runIfModuleReady(moduleName, () => {
window.gw.sdk.reviews.methods.openReviewsDrawer()
.then(console.log)
.catch(console.error);
});
}
});
}

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