panel
Version:
Web Components with Virtual DOM: lightweight composable web apps
15 lines (13 loc) • 316 B
JavaScript
/**
* Attempt to use a high resolution timestamp when in the browswer environment, but fallback to Date.now
* When the performance API is not available.
*/
export const Perf = {
getNow,
};
function getNow() {
if (typeof performance !== `undefined`) {
return performance.now();
}
return Date.now();
}