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