javascript remove event listener if exists code example
Example: removeeventlistener
// type function
element.removeEventListener("mousedown", handleMouseDown)
// full type list available here: https://developer.mozilla.org/en-US/docs/Web/Events