present

High-res timestamps in Node and browser

MIT 6 个版本
安装
npm install present
yarn add present
pnpm add present
bun add present
README

present present on npm build status

High-res timestamps in Node and browser

Installation

In Node: npm install present

In browser:

  1. Copy present.js or present.min.js (with optional source map at present.min.js.map)
  2. <script src="path/to/present.{min.}js"></script>
  3. 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.

版本列表
1.0.0 2016-04-12
0.0.6 2014-05-04
0.0.5 2014-05-04
0.0.4 2014-04-05
0.0.3 2014-04-05
0.0.2 2014-04-04