Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

502
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda