@perf-tools/performance
User Timing polyfill
npm i --save @perf-tools/performance
Usage
// Polyfill
import from '@perf-tools/performance';
// As module
import { performance } from '@perf-tools/performance';
Supported
- Browser, Worker and NodeJS
- API:
-
now - Returns a
DOMHighResTimeStamp
representing the number of milliseconds elapsed since a reference instant. -
mark - Creates a
timestamp
in the browser's performance entry buffer with the given name. -
measure - Creates a named
timestamp
in the browser's performance entry buffer between two specified marks (known as the start mark and end mark, respectively). -
getEntries - Returns a list of
PerformanceEntry
objects based on the given filter. -
getEntriesByType - Returns a list of
PerformanceEntry
objects of the given entry type. -
getEntriesByName - Returns a list of
PerformanceEntry
objects based on the given name and entry type. -
clearMarks - Removes the given
mark
from the browser's performance entry buffer. -
clearMeasures - Removes the given
measure
from the browser's performance entry buffer.
-
now - Returns a
Not Supported
Development
npm i
-
npm test
, code coverage