UNPKG

async-test-util

Version:

Util-functions that are be useful in async tests

16 lines (15 loc) 429 B
import isNode from 'is-node'; import NodeOnly from './require-on-node-only'; /** * same as performance.now() * but works in browsers and nodeJs * @link https://developer.mozilla.org/de/docs/Web/API/Performance/now */ export default function performanceNow() { var perf; if (isNode) { var performance = NodeOnly.perfHooks.performance; perf = performance; } else perf = window.performance; return perf.now(); }