You can use an AbortController to remove all the event listeners at once. When passed a signal as an option, the event listener will be removed when the AbortSignal’s abort() method is called.
Note: Older browsers may not support the options parameter for addEventListener, but it is supported in all modern browsers.