Skip to content

Commit db474a4

Browse files
zerkellafacebook-github-bot
authored andcommitted
RN: Fixed performanceNow() to allow debugging in Chrome
Summary: Discovered when debugging a React Native app in Chrome. The function `performanceNow` was recently changed, so that in Chrome it now refers to `performance.now()` method. However, `now()` cannot be called standalone without a context. Reproduced by a synthetic example in Chrome: ``` const performanceNow = window.performance.now; performanceNow(); Uncaught TypeError: Illegal invocation at <anonymous>:1:1 ``` Changelog: [General] [Fixed] - Fix failure when debugging code in a browser; was caused by `performanceNow()` function. Reviewed By: cpojer Differential Revision: D22739176 fbshipit-source-id: f89b8a215b7b4c430ffd72a1d23539c4f1b31d24
1 parent 00bc73f commit db474a4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Libraries/Utilities/createPerformanceLogger.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
const Systrace = require('../Performance/Systrace');
1414

1515
const infoLog = require('./infoLog');
16-
const performanceNow = global.nativeQPLTimestamp ?? global.performance.now;
16+
const performanceNow =
17+
global.nativeQPLTimestamp ?? global.performance.now.bind(global.performance);
1718

1819
type Timespan = {
1920
description?: string,

0 commit comments

Comments
 (0)