private measure()

in src/lib/event-timer.ts [253:274]


	private measure(endMark: string): void {
		const startMark = endMark.replace('End', 'Start');
		const measureName = endMark.replace('End', '');
		const startMarkExists =
			window.performance.getEntriesByName(startMark).length > 0;
		if (startMarkExists) {
			try {
				const measure = window.performance.measure(
					measureName,
					startMark,
					endMark,
				);

				// we only want to save the measures that are related to certain slots or the page
				if (measure && shouldSave(measureName)) {
					this._measures.set(measureName, measure);
				}
			} catch (e) {
				log('commercial', `error measuring ${measureName}`, e);
			}
		}
	}