Skip to content

Instantly share code, notes, and snippets.

@alefra88
Created July 14, 2024 01:18
Show Gist options
  • Save alefra88/a49135cb7fb3c8c1bf365b6c9e17507c to your computer and use it in GitHub Desktop.
Save alefra88/a49135cb7fb3c8c1bf365b6c9e17507c to your computer and use it in GitHub Desktop.
Proteger de multiples clicks
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