Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _getEntries() {
const entries: PerformanceEntries = {};
const performanceNavigationTiming = (otperformance.getEntriesByType(
'navigation'
)[0] as unknown) as PerformanceEntries;
if (performanceNavigationTiming) {
const keys = Object.values(PTN);
keys.forEach((key: string) => {
if (hasKey(performanceNavigationTiming, key)) {
const value = performanceNavigationTiming[key];
if (typeof value === 'number' && value > 0) {
entries[key] = value;
}
}
});
} else {
// // fallback to previous version
const perf: typeof otperformance & PerformanceLegacy = otperformance;
private _addResourcesSpans(rootSpan: Span): void {
const resources: PerformanceResourceTiming[] = otperformance.getEntriesByType(
'resource'
) as PerformanceResourceTiming[];
if (resources) {
resources.forEach(resource => {
this._initResourceSpan(resource, {
parent: rootSpan,
});
});
}
}