reactotron-core-client
Version:
Grants Reactotron clients the ability to talk to a Reactotron server.
47 lines (46 loc) • 917 B
JavaScript
;
/**
* Runs small high-unscientific benchmarks for you.
*/
const benchmark = () => reactotron => {
const {
startTimer
} = reactotron;
const benchmark = title => {
const steps = [];
const elapsed = startTimer();
const step = stepTitle => {
const previousTime = steps.length === 0 ? 0 : steps[steps.length - 1].time;
const nextTime = elapsed();
steps.push({
title: stepTitle,
time: nextTime,
delta: nextTime - previousTime
});
};
steps.push({
title,
time: 0,
delta: 0
});
const stop = stopTitle => {
step(stopTitle);
reactotron.send("benchmark.report", {
title,
steps
});
};
return {
step,
stop,
last: stop
};
};
return {
features: {
benchmark
}
};
};
export default benchmark;
//# sourceMappingURL=benchmark.js.map