I have two event listeners, one for a Click and a Touch event. They both should run the same function, but only once. If they are both true on some devices it runs the function twice.
I want to be able to click a button and listen for two event listeners but only run the function once if either of them is triggered.
window.addEventListener("click", function(event) {
myFunction();
});
window.addEventListener("touchstart", function(event) {
myFunction();
});
function myFunction() {
console.log("Clicked");
}