JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4
  • Score
    100M100P100Q24231F
  • License ISC

Cross-environment (nodejs/web) performance object

Package Exports

  • @js-bits/performance

Readme

Cross-environment (nodejs/web) performance object

This package exports window.performance object in a browser and built-in Performance measurement APIs module in a Node.js environment. Which is helpful when you develop a package compatible with both environments and use performance for some measurements. Allows to avoid conditional imports.

Installation

Install with npm:

npm install @js-bits/performance

Install with yarn:

yarn add @js-bits/performance

Import where you need it:

import performance from '@js-bits/performance';

or require for CommonJS:

const performance = require('@js-bits/performance');

How to use

const t = performance.now();

Notes

  • Minimal size (bytes) in a browser since Performance API is natively supported. Does not include any polyfills.