How to remove an eventListener with a listener using .bind()

Hi guys, does anyone have an idea how can I overcome this problem?
No description
2 Replies
missymae
missymae11mo ago
Carter Li
CSS-Tricks
Using AbortController as an Alternative for Removing Event Listener...
The idea of an “abortable” fetch came to life in 2017 when AbortController was released. That gives us a way to bail on an API request initiated by fetch() —
MarkBoots
MarkBoots11mo ago
// Define the listener function
function boundDeleteMovie() {
deleteMovie.call(this, movieId);
}
// Add the event listener
confirmDeleteMovieButton.addEventListener("click", boundDeleteMovie);

// To remove the event listener
confirmDeleteMovieButton.removeEventListener("click", boundDeleteMovie);
// Define the listener function
function boundDeleteMovie() {
deleteMovie.call(this, movieId);
}
// Add the event listener
confirmDeleteMovieButton.addEventListener("click", boundDeleteMovie);

// To remove the event listener
confirmDeleteMovieButton.removeEventListener("click", boundDeleteMovie);
Want results from more Discord servers?
Add your server