Created
July 14, 2024 01:18
-
-
Save alefra88/a49135cb7fb3c8c1bf365b6c9e17507c to your computer and use it in GitHub Desktop.
Proteger de multiples clicks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function eventManager(){ | |
let executing = false; | |
return async ()=>{ | |
if(!executing){ | |
executing = true; | |
await fn(); | |
setTimeout(()=>{executing = false},2000); | |
} | |
} | |
} | |
const managerURL = eventManager(get); | |
//funcion get | |
async function get(){ | |
const json = await fetch("https://index.domain.com/cosas/cosas") | |
.then(response=>response.json()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment