If you want to add an event listener and run it only once, you can use the once option.

element.addEventListener('click', () => console.log('I run only once'), {
  once: true,
})