@openameba/cwv-logger
Advanced tools
Comparing version 0.0.1-1 to 0.1.0
{ | ||
"name": "@openameba/cwv-logger", | ||
"version": "0.0.1-1", | ||
"version": "0.1.0", | ||
"main": "./index.js", | ||
@@ -5,0 +5,0 @@ "module": "./index.mjs", |
@@ -8,3 +8,3 @@ # cwv-logger | ||
```sh | ||
yarn add -D cwv-logger | ||
yarn add -D @openameba/cwv-logger | ||
``` | ||
@@ -15,3 +15,3 @@ | ||
``` | ||
npm i --save-dev cwv-logger | ||
npm i --save-dev @openameba/cwv-logger | ||
``` | ||
@@ -39,2 +39,4 @@ | ||
// Logging is not critical for most application, | ||
// so you can avoid loading this library in initial bundle by using dynamic import. | ||
import("@openameba/cwv-logger").then( | ||
@@ -41,0 +43,0 @@ ({ reportCLS, reportFID, reportLCP, reportTTFB }) => { |
@@ -1,2 +0,2 @@ | ||
export declare const SupportMetrics: { | ||
export declare const SupportedMetrics: { | ||
readonly LCP: "LCP"; | ||
@@ -8,3 +8,3 @@ readonly CLS: "CLS"; | ||
export declare type ReportParams = { | ||
metricsName: keyof typeof SupportMetrics; | ||
metricsName: keyof typeof SupportedMetrics; | ||
metricsValue: number; | ||
@@ -11,0 +11,0 @@ networkType: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SupportMetrics = void 0; | ||
exports.SupportMetrics = { | ||
exports.SupportedMetrics = void 0; | ||
exports.SupportedMetrics = { | ||
LCP: "LCP", | ||
@@ -6,0 +6,0 @@ CLS: "CLS", |
@@ -49,6 +49,10 @@ "use strict"; | ||
var reportHandler = function (metrics) { | ||
if (metrics.name !== types_1.SupportMetrics.CLS) { | ||
if (metrics.name !== types_1.SupportedMetrics.CLS) { | ||
return; | ||
} | ||
var name = metrics.name, entries = metrics.entries, delta = metrics.delta; | ||
/** | ||
* To analyze CLS by using some analytics tools, the reported data should be aggregated with largest layout shift source. | ||
* @see https://web.dev/debug-web-vitals-in-the-field/#cls | ||
*/ | ||
var largestSource = getLargestLayoutShiftSource(entries); | ||
@@ -73,3 +77,3 @@ if (!largestSource) { | ||
var reportHandler = function (metrics) { | ||
if (metrics.name !== types_1.SupportMetrics.LCP) { | ||
if (metrics.name !== types_1.SupportedMetrics.LCP) { | ||
return; | ||
@@ -93,3 +97,3 @@ } | ||
var reportHandler = function (metrics) { | ||
if (metrics.name !== types_1.SupportMetrics.FID) { | ||
if (metrics.name !== types_1.SupportedMetrics.FID) { | ||
return; | ||
@@ -114,3 +118,3 @@ } | ||
var name = _a.name, delta = _a.delta; | ||
if (name !== types_1.SupportMetrics.TTFB) { | ||
if (name !== types_1.SupportedMetrics.TTFB) { | ||
return; | ||
@@ -117,0 +121,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27021
388
73