Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7973523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:07:43+00:00 2026-06-04T08:07:43+00:00

Event.timeStamp The timeStamp attribute must return the value it was initialized to. When an

  • 0

Event.timeStamp

The timeStamp attribute must return the value it was initialized to. When an event is created the attribute must be initialized to the number of milliseconds that has passed since 00:00:00 UTC on 1 January 1970.

One could trap both new Event and document.createEvent to set the timeStamp accordingly but how do you intercept events created and dispatched by the browser?

One could add an event listener (capture phase) to the document that listens on “every” event type and write the timeStamp as close to the dispatch time but that would be an ugly hack.

  • Are there any better ways to emulate Event.timeStamp ?
  • Are there any potential traps with intercepting new Event / new CustomEvent and document.createEvent.
  • Are there other ways to create events programmaticly ?
  • Are there any potential issues with adding event listeners to document and manually setting timeStamp as early as possible ?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:07:46+00:00Added an answer on June 4, 2026 at 8:07 am

    Another option is to add the timestamp in the handler. Presumably, only code you write actually cares about the timestamp, and since you are in control of code you write, you can use your own “listen” helper function. Something like:

    var myAddListener = function(name, fn, scope){
        addEventListener(name, function(e){
            if(!e.timeStamp) e.timeStamp = +new Date;
            fn.apply(scope || null, arguments);
        });
    }
    

    As long as your timestamp-dependant code is attached with this, you’re fine. Note, I added a ‘scope’ argument while I was at it…it’s a handy way of preserving ‘this’ when using listeners within class instances.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've datasets in a table with a timestamp value and an event string. How
One of our Postgres tables, called rep_event, has a timestamp column that indicates when
I have two streams of objects that each have a Timestamp value. Both streams
I need a single timestamp of milliseconds (ms) since epoch. This should not be
I have a table that looks like this: Timestamp Event User ================ ===== =====
I have a javascript that has custom indexes, I created them like so: var
I am trying to get the latest event timestamp for each host, google search
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { touchStartTime = [event timestamp]; } -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
public interface Event { Guid identifier; Timestamp ts; } We're thinking of using Reactive
Example 1: <time> <timestamp>01:00</timestamp> <event>arrived<event> </time> <time> <timestamp>02:00</timestamp> <event>left<event> </time> Example 2: <time> <timestamp>02:00</timestamp>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.