chore: fix perf hook integration with node environment

This commit is contained in:
deepak1556 2021-11-17 23:35:22 +09:00 committed by Johannes Rieken
parent 479cc2c593
commit 2fc6cc9a64
No known key found for this signature in database
GPG key ID: 96634B5AF12F8798

View file

@ -40,7 +40,9 @@
*/
function _define() {
if (typeof performance === 'object' && typeof performance.mark === 'function') {
// Identify browser environment when following property is not present
// https://nodejs.org/dist/latest-v16.x/docs/api/perf_hooks.html#performancenodetiming
if (typeof performance === 'object' && typeof performance.mark === 'function' && !performance.nodeTiming) {
// in a browser context, reuse performance-util
if (typeof performance.timeOrigin !== 'number' && !performance.timing) {