present
![build status](https://camo.githubusercontent.com/e04dfa5f7a266365b52ec77f411056bbfe0b0814512d4d6ecef46f17b1917dd7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f64626b61706c756e2f70726573656e742e7376673f6d61784167653d32353932303030)
High-res timestamps in Node and browser
Installation
In Node: npm install present
In browser:
- Copy
present.js
orpresent.min.js
(with optional source map atpresent.min.js.map
) <script src="path/to/present.{min.}js"></script>
performance.now
is automatically polyfilled -- if this is undesired,present.noConflict();
Usage
Node only: var present = require('present');
present()
Returns a timestamp in milliseconds. In node, this uses process.hrtime
. In the browser, the following are attempted (in order):
performance.now()
performance.webkitNow()
performance.msNow()
performance.mozNow()
performance.oNow()
Date.now()
new Date().getTime()
present.noConflict()
Browser only. Resets performance.now
to what it was before present
was included or present.conflict
was called.
present.conflict()
Browser only. Polyfills performance.now
.