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

111
Visualizações
Can you call an IIFE after it has need invoked already without reloading the page?

Is it possible to call a IIFE function again without reloading the page? Similar to the way you call a regular function.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Not unless the IIFE itself is inside a function, and you trigger that function itself again, eg

const fn = () => {
  (() => {
    // do stuff
  })();
};
fn();
fn();

Which is weird.

If you want to be able to call something more than once, you should put into a variable so it can be referenced again - a regular named function

const fn = () => {
  // do stuff
};
fn();
fn();

An IIFE is designed to be the sort of thing that (usually) runs exactly once. If you want to run something multiple times, an IIFE is not the right tool for the job.

about 4 years ago · Juan Pablo Isaza Relatório
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