mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add a lazy shim for ReactPerf
This prevents a circular dependency between ReactGKJSModule and ReactDOM
This commit is contained in:
@@ -7,13 +7,64 @@
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule ReactPerf
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
||||
} = require('ReactDOM');
|
||||
// There is a cyclical dependency between ReactGK and
|
||||
// this module. Add an indirection to delay it.
|
||||
// We will remove this anyway.
|
||||
|
||||
module.exports = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactPerf;
|
||||
function getReactPerf() {
|
||||
const {
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
||||
} = require('ReactDOM');
|
||||
return __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactPerf;
|
||||
}
|
||||
|
||||
const LazyReactPerf = {
|
||||
getLastMeasurements(...args) {
|
||||
return getReactPerf().getLastMeasurements(...args);
|
||||
},
|
||||
getExclusive(...args) {
|
||||
return getReactPerf().getExclusive(...args);
|
||||
},
|
||||
getInclusive(...args) {
|
||||
return getReactPerf().getInclusive(...args);
|
||||
},
|
||||
getWasted(...args) {
|
||||
return getReactPerf().getWasted(...args);
|
||||
},
|
||||
getOperations(...args) {
|
||||
return getReactPerf().getOperations(...args);
|
||||
},
|
||||
printExclusive(...args) {
|
||||
return getReactPerf().printExclusive(...args);
|
||||
},
|
||||
printInclusive(...args) {
|
||||
return getReactPerf().printInclusive(...args);
|
||||
},
|
||||
printWasted(...args) {
|
||||
return getReactPerf().printWasted(...args);
|
||||
},
|
||||
printOperations(...args) {
|
||||
return getReactPerf().printOperations(...args);
|
||||
},
|
||||
start() {
|
||||
return getReactPerf().start();
|
||||
},
|
||||
stop() {
|
||||
return getReactPerf().stop();
|
||||
},
|
||||
isRunning(...args) {
|
||||
return getReactPerf().isRunning(...args);
|
||||
},
|
||||
printDOM(...args) {
|
||||
return getReactPerf().printDOM(...args);
|
||||
},
|
||||
getMeasurementsSummaryMap(...args) {
|
||||
return getReactPerf().getMeasurementsSummaryMap(...args);
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = LazyReactPerf;
|
||||
|
||||
Reference in New Issue
Block a user