Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React from 'react';
import ReactDOM from 'react-dom';
import Perf from 'react-addons-perf';
import ReactDemoApp from './ui/ReactDemoApp';
Perf.start(); // see https://facebook.github.io/react/docs/perf.html
const then = Date.now();
ReactDOM.render(, document.querySelector('#container'));
const now = Date.now();
Perf.stop();
// for NODE_ENV=production
console.log('Total render time:', now - then, 'ms');
Perf.printInclusive();
Perf.printExclusive();
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);
}
setTimeout(() => {
Perf.stop();
Perf.printInclusive();
Perf.printExclusive();
}, 25000);
this._root = ReactDOM.render(React.createElement(Root), node, () => {
perfAddon.stop();
perfAddon.printInclusive();
perfAddon.printExclusive();
perfAddon.printWasted();
if (cb) {
return cb();
}
return null;
});
this._node = node;
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
},
setTimeout(function () {
Perf.stop()
Perf.printInclusive()
Perf.printExclusive()
Perf.printWasted()
PPP.log()
}, 200)
}
handlePerfStop() {
Perf.stop();
Perf.printInclusive();
//Perf.printWasted();
//Perf.printOperations();
}
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
},
componentDidMount: function() {
if (this.props.flux.stores.config.debug && Perf) {
var measurements = Perf.stop();
Perf.printInclusive(measurements);
utils.debug("Inclusive", "^");
Perf.printExclusive(measurements);
utils.debug("Exclusive", "^");
Perf.printWasted(measurements);
utils.debug("Wasted", "^");
}
},