perf-marks
Version:
The simplest and lightweight solution for User Timing API in Javascript.
10 lines (9 loc) • 350 B
JavaScript
import { isUserTimingAPISupported } from './is-user-timing-api-supported';
const getEntriesByType = (entryName) => {
if (!isUserTimingAPISupported) {
return [];
}
return performance.getEntriesByType(entryName) || [];
};
const getNavigationMarker = () => getEntriesByType('navigation').pop() || {};
export { getNavigationMarker };