Skip to main content

closeWishlistsDrawer()

closeWishlistsDrawer(): Promise<Success | ErrorResult>

Closes the Wishlists drawer.

Returns​

Promise<Success | ErrorResult>

Promise that resolves to a success result or rejects with an error

Example​

Ensure the SDK is ready, the WishlistDrawerWidget is injected, and the WishlistsSdk module is ready.

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

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