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();
const dispatchMessage = (msg) => {
// let timer = profiler.start('dispatchMessage');
Perf.start();
if (msg.type === RECEIVE_MESSAGE) {
store.dispatch(newTabMaybe('Hub', 'hubMessages', ''));
} else if (msg.type === RECEIVE_PRIVATE_MESSAGE) {
store.dispatch(newTabMaybe(msg.from, 'privateMessages', msg.from));
}
store.dispatch(msg);
Perf.stop();
const measurements = Perf.getLastMeasurements();
// Perf.printInclusive(measurements);
Perf.printExclusive(measurements);
Perf.printWasted(measurements);
// timer.stop('dispatchMessage');
};
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);
}
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", "^");
}
},
setTimeout(() => {
Perf.stop();
Perf.printInclusive();
Perf.printExclusive();
}, 25000);
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
},
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;
setTimeout(function () {
Perf.stop()
Perf.printInclusive()
Perf.printExclusive()
Perf.printWasted()
PPP.log()
}, 200)
}