Every time my component is rendered, I attach an event listener.
mounted() {
window.addEventListener("keydown", e => this.moveIndex(e));
}
Interestingly, even when placed within the moveIndex method itself, the event listener persists and cannot be removed. Here's how I am attempting to remove it:
moveIndex(e) {
...
case 0:
player.play({
uri: "https://tv-trtturk.live.trt.com.tr/master.m3u8"
});
window.removeEventListener("keydown", e => this.moveIndex(e));
break;
...
}
Despite trying to remove the event listener through a button click event, I encounter the same issue of it not being removed. Am I overlooking something?