I'm currently handling a specific event:
event = new CustomEvent("storeEmailData", {
detail: {
name: name,
email: email,
content: content
}
});
window.dispatchEvent(event);
window.addEventListener("storeEmailData", this.handleStoreEmail);
I am looking to unsubscribe from the event listener. I have attempted the following approaches:
window.removeEventListener("storeEmailData", this.handleStoreEmail);
window.removeEventListener("storeEmailData");
However, none of these methods seem to be working. Can you help me identify what I might be doing incorrectly?