Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default store => next => action => {
const key = `performance:${action.type}`
Perf.start()
// will re-render the application with new state
const result = next(action)
Perf.stop()
console.group(key) //eslint-disable-line
console.info('wasted') //eslint-disable-line
Perf.printWasted()
// any other Perf measurements you are interested in
console.groupEnd(key) //eslint-disable-line
return result
}
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');
};
setTimeout(function () {
Perf.stop()
Perf.printInclusive()
Perf.printExclusive()
Perf.printWasted()
PPP.log()
}, 200)
}
toggle = () => {
const { started } = this.state;
started ? Perf.stop() : Perf.start();
this.setState({ started: !started });
};
return {
increase: (...args) => dispatch(actions.increase(...args)),
decrease: (...args) => dispatch(actions.decrease(...args))
}
}
但是我们整个应用中并没有actionCreator,所以在dispatch的时候是没有action这个plain对象的
原因在于:我们在mapDispatchToProps中采用了对象而不是函数的情况,所以此时相当于直接执行这个
函数,同时将函数的返回值直接dispatch出去。可以将component和redux解耦。
注意:我们这里发出去的action会被clientMiddleware处理转化为真正的action
*/}
<footer>
)
}
}
Perf.stop();</footer>
componentDidUpdate() {
ReactPerf.stop();
const measurements = ReactPerf.getLastMeasurements();
ReactPerf.printWasted(measurements);
ReactPerf.start();
}
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();
const measures = Perf.getLastMeasurements();
Perf.printWasted(measures);
Perf.printOperations(measures);
}, 0);
}
toggle = () => {
const { started } = this.state;
started ? Perf.stop() : Perf.start();
this.setState({ started: !started });
};
componentDidUpdate = () => {
Perf.stop()
let m = Perf.getLastMeasurements()
Perf.printWasted(m)
if (!this.state.actionsOpen) {
this.actionsClicked = false
}
}