Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

493
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!