UNPKG

tethysfaceid

Version:

1 lines 2.07 kB
{"ast":null,"code":"\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\n\nvar _webVitals = require(\"next/dist/compiled/web-vitals\");\n\nvar initialHref = location.href;\nvar isRegistered = false;\nvar userReportHandler;\n\nfunction onReport(metric) {\n if (userReportHandler) {\n userReportHandler(metric);\n } // This code is not shipped, executed, or present in the client-side\n // JavaScript bundle unless explicitly enabled in your application.\n //\n // When this feature is enabled, we'll make it very clear by printing a\n // message during the build (`next build`).\n\n\n if (true && // This field is empty unless you explicitly configure it:\n process.env.__NEXT_ANALYTICS_ID) {\n var body = {\n dsn: process.env.__NEXT_ANALYTICS_ID,\n id: metric.id,\n page: window.__NEXT_DATA__.page,\n href: initialHref,\n event_name: metric.name,\n value: metric.value.toString(),\n speed: 'connection' in navigator && navigator['connection'] && 'effectiveType' in navigator['connection'] ? navigator['connection']['effectiveType'] : ''\n };\n var blob = new Blob([new URLSearchParams(body).toString()], {\n // This content type is necessary for `sendBeacon`:\n type: 'application/x-www-form-urlencoded'\n });\n var vitalsUrl = 'https://vitals.vercel-insights.com/v1/vitals';\n navigator.sendBeacon && navigator.sendBeacon(vitalsUrl, blob) || fetch(vitalsUrl, {\n body: blob,\n method: 'POST',\n credentials: 'omit',\n keepalive: true\n });\n }\n}\n\nvar _default = function _default(onPerfEntry) {\n // Update function if it changes:\n userReportHandler = onPerfEntry; // Only register listeners once:\n\n if (isRegistered) {\n return;\n }\n\n isRegistered = true;\n (0, _webVitals.getCLS)(onReport);\n (0, _webVitals.getFID)(onReport);\n (0, _webVitals.getFCP)(onReport);\n (0, _webVitals.getLCP)(onReport);\n (0, _webVitals.getTTFB)(onReport);\n};\n\nexports[\"default\"] = _default;","map":null,"metadata":{},"sourceType":"script"}