Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

145
Visualizações
How does a pointer event passed as an argument in debounce?

I am confused about how the pointer event is passed to the debounce() in addEventListener(). For the constant variable multiply it takes the two arguments which are passed as args in debounce(). However, when it is used in .addEventListener() I only see the syntax that defines the function. So how does the pointer event is passed as an argument like the first example?

function debounce(func, timeout = 1000) {
  let timer;
  return (...args) => {
    if (timer) clearTimeout(timer);
    timer = setTimeout(() => {
      func(...args);
    }, timeout);
  };
}

const multiply = debounce((x, y) => console.log(x * y));
multiply(10, 10); //I see that this takes the arguments that assign to x and y 
 
button.addEventListener(
  "click",
  debounce((e) => console.log("clicked")));
//but here I am confused how the pointer event is being passed as an argument
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda