Welcome to mirror list, hosted at ThFree Co, Russian Federation.

performance_utils.js « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 48a2958f5cc02f7b393915b37c1d9bfffae8091c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
export const performanceMarkAndMeasure = ({ mark, measures = [] } = {}) => {
  window.requestAnimationFrame(() => {
    if (mark && !performance.getEntriesByName(mark).length) {
      performance.mark(mark);
    }
    measures.forEach(measure => {
      window.requestAnimationFrame(() =>
        performance.measure(measure.name, measure.start, measure.end),
      );
    });
  });
};