Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
endTest() {
const measurements = Perf.getLastMeasurements();
const wasted = Perf.getWasted(measurements);
const summary = {};
summary.hasWastedTime = component => {
const result = find(wasted, n => n.key.indexOf(`> ${component}`));
if (result) {
return (
`${result.key} wasted ${result.inclusiveRenderDuration}ms ` +
`across ${result.renderCount} renders`
);
}
return false;
};
return this.props.onComplete(summary);
handleStop() {
Perf.stop();
const measurements = Perf.getLastMeasurements();
console.log('Inclusive');
Perf.printInclusive(measurements);
console.log('Exclusive');
Perf.printExclusive(measurements);
console.log('Wasted');
Perf.printWasted(measurements);
console.log('DOM');
Perf.printOperations(measurements);
}
perf: () => {
const Perf = require('react-addons-perf')
if (perfStarted) {
Perf.stop()
const lm = Perf.getLastMeasurements()
Perf.printInclusive(lm)
Perf.printExclusive(lm)
Perf.printWasted(lm)
perfStarted = false
} else {
Perf.start()
perfStarted = true
}
return Perf
},
perf: () => {
const Perf = require('react-addons-perf')
if (perfStarted) {
Perf.stop()
const lm = Perf.getLastMeasurements()
Perf.printInclusive(lm)
Perf.printExclusive(lm)
Perf.printWasted(lm)
perfStarted = false
} else {
Perf.start()
perfStarted = true
}
return Perf
},
componentDidUpdate = () => {
Perf.stop()
let m = Perf.getLastMeasurements()
Perf.printWasted(m)
if (!this.state.actionsOpen) {
this.actionsClicked = false
}
}
printWasted = () => {
const lastMeasurements = Perf.getLastMeasurements();
Perf.printWasted(lastMeasurements);
};
printOperations = () => {
const lastMeasurements = Perf.getLastMeasurements();
Perf.printOperations(lastMeasurements);
};
printWasted = () => {
const lastMeasurements = Perf.getLastMeasurements();
Perf.printWasted(lastMeasurements);
};
setTimeout(() => {
Perf.stop();
const measures = Perf.getLastMeasurements();
Perf.printWasted(measures);
Perf.printOperations(measures);
}, 0);
}
this.forceUpdate(() => {
Perf.stop()
Perf.printWasted(Perf.getLastMeasurements())
})
}