UNPKG

coach-core

Version:
20 lines (17 loc) 532 B
(function () { 'use strict'; // Let's use the Resource Timing API, so it is important that we run // this after all request/responses are finished if (globalThis.performance && globalThis.performance.getEntriesByType) { const resources = globalThis.performance.getEntriesByType('resource'); let max = 0; for (let i = 0, len = resources.length; i < len; i++) { if (resources[i].responseEnd > max) { max = resources[i].responseEnd; } } return max; } else { return -1; } })();