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

505
Visualizações
What's the difference between GlobalEventHandlers.onresize and Window: resize event?

Both of these are commonly used to accomplish the same things so the question is when do I use one or the other?

For example in angular but i belive more web frameworks i can do this:

window.addEventListener('resize', (event: UIEvent) => {
    const window = event.target as Window;
    this.changeConfig(window.innerWidth);
})

Or this:

window.onresize = (event: any) => {
    this.changeConfig(event.target.innerWidth);
};

I have read through the documentation on MDN but don't understand what is the appropriate use case for each.

Window: resize event

GlobalEventHandlers.onresize

I ran into this issue when refactoring some angular code and read this question Property innerWidth does not exist on type EventTarget but was not able to find the difference between the two methods. I am trying to gain a deeper understanding and write some performant code so any advice or documentation is appreciated.

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