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

319
Views
Could someone explain what the 'event' object actually is and how it works on a technical level?

I was wondering if someone could elaborate on what the event object actually is. I have looked at many sources that all seem to say it is an object that holds information about the current event.

My question is, what is it really? Is it a single global object that holds every event type? Or is there an event object for each unique event that occurs. I have seen in code you can write things like event.type, event.cancelBubble etc. does this mean I can access the event anytime and modify it from anywhere in the code? I have seen in examples of functions accepting an event as an argument, but why should this be if it is a global variable accessible anywhere?

I know this seems a bit broad but most sources seem to not go too much into how the event object works on a lower level. So if someone could clear this confusion for me that would be appreciated.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

You are referring to the Window.event, which is no longer recommended for use. It is from a time when JavaScript had simpler goals and looser scope.

The read-only Window property event returns the Event which is currently being handled by the site's code. Outside the context of an event handler, the value is always undefined.

For new code, do not rely on the 'global' event being available and instead use the Event object passed to the event handler.

about 4 years ago · Juan Pablo Isaza Report

0

event is something that signifies something has happened.

If you click,type,resize, something loads etc. all of these are events. When you have a listener on any of these events, you are telling that you want something to happen in reaction to this event. The listener function has an argument event. This event will have details about the event that triggered it.

All these events implement from the same Event interface. So that is what you might be confusing it with. A bunch of event types - MouseEvent, ClipboardEvent etc. implement this. And events like click,dbclick,keyup etc. are then events using these interfaces. So it is like a chain you see. The properties you mentioned might belong to any of the interface at top level and are available at these specific events.

Note, you can create events too. This is helpful when you want to trigger events on your own. You can start with new Event().

about 4 years ago · Juan Pablo Isaza Report
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!