Socket
Socket
Sign inDemoInstall

@aller/blink-labrador

Package Overview
Dependencies
Maintainers
11
Versions
284
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aller/blink-labrador - npm Package Compare versions

Comparing version 8.24.10-alpha.0 to 8.24.11-alpha.0

5

lib/main.js

@@ -210,5 +210,6 @@ "use strict";

var webVitals = vitalsTracker.getAllMetrics();
var now = vitalsTracker.now();
window.setTimeout(function () {
console.log('Web vitals from timeout', webVitals);
if (webVitals) {
webVitals.visitDurationAtSend = now;
_this_1.blink.webVitals({ webVitals: webVitals });

@@ -221,4 +222,4 @@ // start another measurement for sending with the hidden state

if (document.visibilityState === 'hidden') {
console.log('Web vitals from documenthidden callback', webVitals);
if (webVitals) {
webVitals.visitDurationAtSend = now;
_this_1.blink.webVitals({ webVitals: webVitals });

@@ -225,0 +226,0 @@ }

@@ -0,1 +1,2 @@

import type { Metric } from 'web-vitals';
type LogMetric = {

@@ -16,2 +17,3 @@ value: number;

webVitalsReport: WebVitalsReport;
mapMetric(metric: Metric): LogMetric | undefined;
cls(): void;

@@ -24,4 +26,5 @@ ttfb(): void;

get performanceAPISupported(): boolean;
getAllMetrics(): WebVitalsReport | undefined;
now(): number;
getAllMetrics(now?: number): WebVitalsReport | undefined;
}
export default ChromeWebVitals;

51

lib/utils/chrome-web-vitals.js

@@ -19,31 +19,37 @@ "use strict";

}
ChromeWebVitals.prototype.mapMetric = function (metric) {
var report = this.webVitalsReport[metric.name];
if (!report)
return;
return formatCWVreport(metric);
};
ChromeWebVitals.prototype.cls = function () {
var _this = this;
return (0, attribution_1.onCLS)(function (report) {
_this.webVitalsReport[report.name] = formatCWVreport(report);
}, { reportAllChanges: true });
return (0, attribution_1.onCLS)(function (metric) { return _this.mapMetric(metric); }, {
reportAllChanges: true,
});
};
ChromeWebVitals.prototype.ttfb = function () {
var _this = this;
return (0, web_vitals_1.onTTFB)(function (report) {
_this.webVitalsReport[report.name] = formatCWVreport(report);
}, { reportAllChanges: true });
return (0, web_vitals_1.onTTFB)(function (metric) { return _this.mapMetric(metric); }, {
reportAllChanges: true,
});
};
ChromeWebVitals.prototype.lcp = function () {
var _this = this;
return (0, attribution_1.onLCP)(function (report) {
_this.webVitalsReport[report.name] = formatCWVreport(report);
}, { reportAllChanges: true });
return (0, attribution_1.onLCP)(function (metric) { return _this.mapMetric(metric); }, {
reportAllChanges: true,
});
};
ChromeWebVitals.prototype.inp = function () {
var _this = this;
return (0, web_vitals_1.onINP)(function (report) {
_this.webVitalsReport[report.name] = formatCWVreport(report);
}, { reportAllChanges: true });
return (0, web_vitals_1.onINP)(function (metric) { return _this.mapMetric(metric); }, {
reportAllChanges: true,
});
};
ChromeWebVitals.prototype.fcp = function () {
var _this = this;
return (0, web_vitals_1.onFCP)(function (report) {
_this.webVitalsReport[report.name] = formatCWVreport(report);
}, { reportAllChanges: true });
return (0, web_vitals_1.onFCP)(function (metric) { return _this.mapMetric(metric); }, {
reportAllChanges: true,
});
};

@@ -63,3 +69,8 @@ ChromeWebVitals.prototype.fid = function () {

});
ChromeWebVitals.prototype.getAllMetrics = function () {
ChromeWebVitals.prototype.now = function () {
if (typeof performance === 'undefined')
return 0;
return roundToPrec(performance.now(), 0);
};
ChromeWebVitals.prototype.getAllMetrics = function (now) {
if (!this.performanceAPISupported)

@@ -73,4 +84,3 @@ return;

this.fid();
this.webVitalsReport.visitDurationAtSend = now();
console.log('webvitalsreport in chrome-web-vitals class getAllMetrics', this.webVitalsReport);
this.webVitalsReport.visitDurationAtSend = now || 0;
return this.webVitalsReport;

@@ -80,7 +90,2 @@ };

}());
function now() {
if (typeof performance === 'undefined')
return 0;
return roundToPrec(performance.now(), 0);
}
function roundToPrec(val, precision) {

@@ -87,0 +92,0 @@ if (precision === void 0) { precision = 0; }

{
"name": "@aller/blink-labrador",
"version": "8.24.10-alpha.0",
"version": "8.24.11-alpha.0",
"description": "Library for using blink on Labrador",

@@ -76,3 +76,3 @@ "main": "lib/main.js",

"dependencies": {
"@aller/blink": "^8.24.10-alpha.0",
"@aller/blink": "^8.24.11-alpha.0",
"@soldotno/aller-in-view": "^3.0.2",

@@ -96,3 +96,3 @@ "react": "^16.11.0",

},
"gitHead": "5862609b742aa22570f7f74d855f0b0898244be1"
"gitHead": "7e9c79d9ccbf28a2a10ab129b9a23e40099a4353"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc