UNPKG

reactotron-core-client

Version:

Grants Reactotron clients the ability to talk to a Reactotron server.

51 lines (50 loc) 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; /** * 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 } }; }; var _default = exports.default = benchmark; //# sourceMappingURL=benchmark.js.map