Skip to content

majido/high-resolution-timestamp-polyfill

Repository files navigation

High-Resolution Timestamp Polyfill Build Status

Introduction

This repository hosts utilities to help with Event.timeStamp transition from DOMTimeStamp to DOMHighResTimeStamp.

Background

Browsers (Chrome, Firefox) and the [DOM spec] spec-bug are in the process of updating event timestamp from being a DOMTimeStamp to a DOMHighResTimeStamp.

DOMTimeStamp is a time value in milliseconds relative to an arbitrary epoch. Most browsers use system epoch making the value comparable to Date.now() in those browsers. In contrast [DOMHighResTimeStamp] highres-timestamp-mdn is a time value in milliseconds but with microseconds precision (i.e., decimal component) which is relative to performance.timing.navigationStart making it comparable to performance.now().

To better understand the potential impact of this change in existing code please read the more detailed blog post by Jeff Posnick on Chrome Developer's blog.

Details

  • Conversion function: A simple cross-browser utility function that allows translation of event timestamp to a DOMHighResTimeStamp.

  • Polyfill (work in progress): Makes Event.timeStamp to always be a DOMHighResTimeStamp. This is WIP as it does not work well in Safari yet. Safari support requires a fix for this WebKit bug that prevents overriding getter and setter on the prototype.

License

The MIT License (MIT)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published