summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/performance/utils.js
blob: 0001ef54244ac5ed3160c7925082972001d18f74 (plain)
1
2
3
4
5
6
7
8
9
10
export const performanceMarkAndMeasure = ({ mark, measures = [] } = {}) => {
  window.requestAnimationFrame(() => {
    if (mark && !performance.getEntriesByName(mark).length) {
      performance.mark(mark);
    }
    measures.forEach((measure) => {
      performance.measure(measure.name, measure.start, measure.end);
    });
  });
};