2020-09-29 20:09:53 -04:00
|
|
|
export const performanceMarkAndMeasure = ({ mark, measures = [] } = {}) => {
|
|
|
|
window.requestAnimationFrame(() => {
|
|
|
|
if (mark && !performance.getEntriesByName(mark).length) {
|
|
|
|
performance.mark(mark);
|
|
|
|
}
|
|
|
|
measures.forEach(measure => {
|
2020-10-05 11:08:56 -04:00
|
|
|
performance.measure(measure.name, measure.start, measure.end);
|
2020-09-29 20:09:53 -04:00
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|