debian-mirror-gitlab/app/assets/javascripts/performance/utils.js
2021-03-08 18:12:59 +05:30

10 lines
336 B
JavaScript

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);
});
});
};