perfume.js
Advanced tools
Comparing version 5.3.0 to 6.0.0
# Changelog | ||
## 6.0.0 (2021-5-5) | ||
* **feat:** introduced **Time to First Byte** as his own top-level metric. | ||
* **feat:** simplified **Total Blocking Time** metrics into one solo version that focuses on waiting 10s after **First Input Delay**. | ||
* **feat:** increased the `maxMeasureTime` default value from 15s to 30s, this will allow better data for metrics like LCP which tend to have much higher values. | ||
### Breaking Changes | ||
The two key breaking changes in v6 are focus around the simplification of First Input Delay and Total Blocking Time, and the increase of the default value for `maxMeasureTime`. | ||
## 5.3.0 (2020-9-2) | ||
@@ -4,0 +13,0 @@ |
@@ -6,4 +6,4 @@ export var config = { | ||
// Logging | ||
maxTime: 15000, | ||
maxTime: 30000, | ||
}; | ||
//# sourceMappingURL=config.js.map |
@@ -10,10 +10,5 @@ import { logData, logMetric } from './log'; | ||
// Measure the delay to begin processing the first input event | ||
logMetric(lastEntry.processingStart - lastEntry.startTime, 'fidVitals', { | ||
logMetric(lastEntry.processingStart - lastEntry.startTime, 'fid', { | ||
performanceEntry: lastEntry | ||
}); | ||
// Legacy FID logic | ||
// Measure the duration of processing the first input event | ||
logMetric(lastEntry.duration, 'fid', { | ||
performanceEntry: lastEntry | ||
}); | ||
} | ||
@@ -27,10 +22,5 @@ // Disconnect this observer since callback is only triggered once | ||
logMetric(cls.value, 'cls'); | ||
logMetric(tbt.value, 'tbt'); | ||
// TBT with 5 second delay after FID | ||
// TBT has 10 second delay after FID | ||
setTimeout(function () { | ||
logMetric(tbt.value, "tbt5S"); | ||
}, 5000); | ||
// TBT with 10 second delay after FID | ||
setTimeout(function () { | ||
logMetric(tbt.value, "tbt10S"); | ||
logMetric(tbt.value, "tbt"); | ||
logData('dataConsumption', rt.value); | ||
@@ -37,0 +27,0 @@ }, 10000); |
@@ -14,16 +14,19 @@ import { getDM, getHC } from './constants'; | ||
export var getIsLowEndExperience = function (et, sd) { | ||
if (getIsLowEndDevice()) { | ||
return true; | ||
} | ||
// If the effective type of the connection meaning | ||
// one of 'slow-2g', '2g', '3g', or '4g' is !== 4g | ||
if (['slow-2g', '2g', '3g'].includes(et)) { | ||
return true; | ||
switch (et) { | ||
case 'slow-2g': | ||
return true; | ||
break; | ||
case '2g': | ||
return true; | ||
break; | ||
case '3g': | ||
return true; | ||
break; | ||
default: | ||
// Data Saver preference | ||
return (getIsLowEndDevice() || sd); | ||
} | ||
// Data Saver preference | ||
if (sd) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
//# sourceMappingURL=isLowEnd.js.map |
@@ -5,3 +5,3 @@ import { config } from './config'; | ||
import { logMetric } from './log'; | ||
import { cls, lcp, tbt } from './metrics'; | ||
import { cls, lcp } from './metrics'; | ||
import { perfObservers } from './observeInstances'; | ||
@@ -38,7 +38,3 @@ import { initElementTiming, initFirstPaint, initLargestContentfulPaint, } from './paint'; | ||
} | ||
if (perfObservers[4]) { | ||
logMetric(tbt.value, "tbtFinal"); | ||
poDisconnect(4); | ||
} | ||
}; | ||
//# sourceMappingURL=observe.js.map |
/*! | ||
* Perfume.js v5.3.0 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v6.0.0 (http://zizzamia.github.io/perfume) | ||
* Copyright 2020 Leonardo Zizzamia (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
@@ -12,3 +12,3 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
import { isPerformanceSupported } from './isSupported'; | ||
import { logData } from './log'; | ||
import { logData, logMetric } from './log'; | ||
import { performanceMeasure } from './measure'; | ||
@@ -23,3 +23,3 @@ import { metrics } from './metrics'; | ||
if (options === void 0) { options = {}; } | ||
this.v = '5.3.0'; | ||
this.v = '6.0.0'; | ||
// Extend default config with external options | ||
@@ -43,4 +43,8 @@ config.analyticsTracker = options.analyticsTracker; | ||
} | ||
var navigationTiming = getNavigationTiming(); | ||
// Log Navigation Timing | ||
logData('navigationTiming', getNavigationTiming()); | ||
logData('navigationTiming', navigationTiming); | ||
if (navigationTiming.timeToFirstByte) { | ||
logMetric(navigationTiming.timeToFirstByte, 'ttfb'); | ||
} | ||
// Log Network Information | ||
@@ -47,0 +51,0 @@ logData('networkInformation', getNetworkInformation()); |
@@ -1,2 +0,3 @@ | ||
var fcpScore = [1000, 2500]; | ||
var ttfbScore = [200, 500]; | ||
var fcpScore = [2000, 4000]; | ||
var lcpScore = [2500, 4000]; | ||
@@ -7,2 +8,3 @@ var fidcore = [100, 300]; | ||
export var webVitalsScore = { | ||
ttfb: ttfbScore, | ||
fp: fcpScore, | ||
@@ -13,9 +15,5 @@ fcp: fcpScore, | ||
fid: fidcore, | ||
fidVitals: fidcore, | ||
cls: clsScore, | ||
clsFinal: clsScore, | ||
tbt: tbtScore, | ||
tbt5S: tbtScore, | ||
tbt10S: tbtScore, | ||
tbtFinal: tbtScore, | ||
}; | ||
@@ -22,0 +20,0 @@ export var getVitalsScore = function (measureName, value) { |
@@ -8,4 +8,4 @@ "use strict"; | ||
// Logging | ||
maxTime: 15000, | ||
maxTime: 30000, | ||
}; | ||
//# sourceMappingURL=config.js.map |
@@ -12,10 +12,5 @@ "use strict"; | ||
// Measure the delay to begin processing the first input event | ||
log_1.logMetric(lastEntry.processingStart - lastEntry.startTime, 'fidVitals', { | ||
log_1.logMetric(lastEntry.processingStart - lastEntry.startTime, 'fid', { | ||
performanceEntry: lastEntry | ||
}); | ||
// Legacy FID logic | ||
// Measure the duration of processing the first input event | ||
log_1.logMetric(lastEntry.duration, 'fid', { | ||
performanceEntry: lastEntry | ||
}); | ||
} | ||
@@ -29,10 +24,5 @@ // Disconnect this observer since callback is only triggered once | ||
log_1.logMetric(metrics_1.cls.value, 'cls'); | ||
log_1.logMetric(metrics_1.tbt.value, 'tbt'); | ||
// TBT with 5 second delay after FID | ||
// TBT has 10 second delay after FID | ||
setTimeout(function () { | ||
log_1.logMetric(metrics_1.tbt.value, "tbt5S"); | ||
}, 5000); | ||
// TBT with 10 second delay after FID | ||
setTimeout(function () { | ||
log_1.logMetric(metrics_1.tbt.value, "tbt10S"); | ||
log_1.logMetric(metrics_1.tbt.value, "tbt"); | ||
log_1.logData('dataConsumption', metrics_1.rt.value); | ||
@@ -39,0 +29,0 @@ }, 10000); |
@@ -16,16 +16,19 @@ "use strict"; | ||
exports.getIsLowEndExperience = function (et, sd) { | ||
if (exports.getIsLowEndDevice()) { | ||
return true; | ||
} | ||
// If the effective type of the connection meaning | ||
// one of 'slow-2g', '2g', '3g', or '4g' is !== 4g | ||
if (['slow-2g', '2g', '3g'].includes(et)) { | ||
return true; | ||
switch (et) { | ||
case 'slow-2g': | ||
return true; | ||
break; | ||
case '2g': | ||
return true; | ||
break; | ||
case '3g': | ||
return true; | ||
break; | ||
default: | ||
// Data Saver preference | ||
return (exports.getIsLowEndDevice() || sd); | ||
} | ||
// Data Saver preference | ||
if (sd) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
//# sourceMappingURL=isLowEnd.js.map |
@@ -39,7 +39,3 @@ "use strict"; | ||
} | ||
if (observeInstances_1.perfObservers[4]) { | ||
log_1.logMetric(metrics_1.tbt.value, "tbtFinal"); | ||
performanceObserver_1.poDisconnect(4); | ||
} | ||
}; | ||
//# sourceMappingURL=observe.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/*! | ||
* Perfume.js v5.3.0 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v6.0.0 (http://zizzamia.github.io/perfume) | ||
* Copyright 2020 Leonardo Zizzamia (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
@@ -24,3 +24,3 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
if (options === void 0) { options = {}; } | ||
this.v = '5.3.0'; | ||
this.v = '6.0.0'; | ||
// Extend default config with external options | ||
@@ -44,4 +44,8 @@ config_1.config.analyticsTracker = options.analyticsTracker; | ||
} | ||
var navigationTiming = getNavigationTiming_1.getNavigationTiming(); | ||
// Log Navigation Timing | ||
log_1.logData('navigationTiming', getNavigationTiming_1.getNavigationTiming()); | ||
log_1.logData('navigationTiming', navigationTiming); | ||
if (navigationTiming.timeToFirstByte) { | ||
log_1.logMetric(navigationTiming.timeToFirstByte, 'ttfb'); | ||
} | ||
// Log Network Information | ||
@@ -48,0 +52,0 @@ log_1.logData('networkInformation', getNetworkInformation_1.getNetworkInformation()); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var fcpScore = [1000, 2500]; | ||
var ttfbScore = [200, 500]; | ||
var fcpScore = [2000, 4000]; | ||
var lcpScore = [2500, 4000]; | ||
@@ -9,2 +10,3 @@ var fidcore = [100, 300]; | ||
exports.webVitalsScore = { | ||
ttfb: ttfbScore, | ||
fp: fcpScore, | ||
@@ -15,9 +17,5 @@ fcp: fcpScore, | ||
fid: fidcore, | ||
fidVitals: fidcore, | ||
cls: clsScore, | ||
clsFinal: clsScore, | ||
tbt: tbtScore, | ||
tbt5S: tbtScore, | ||
tbt10S: tbtScore, | ||
tbtFinal: tbtScore, | ||
}; | ||
@@ -24,0 +22,0 @@ exports.getVitalsScore = function (measureName, value) { |
@@ -1,2 +0,2 @@ | ||
var n={t:!1,i:!1,o:15e3},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},c=function(){return r.hardwareConcurrency},a=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},f="4g",s=!1,l=function(){return!!(c()&&c()<=4)||!!(u()&&u()<=4)},m=function(n,t){return!!l()||(!!["slow-2g","2g","3g"].includes(n)||!!t)},v={u:!1},d=function(n){i.hidden&&(n(),v.u=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},g=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},b=[1e3,2500],y=[2500,4e3],k=[100,300],T=[.1,.25],h=[300,600],_={fp:b,fcp:b,lcp:y,lcpFinal:y,fid:k,fidVitals:k,cls:T,clsFinal:T,tbt:h,tbt5S:h,tbt10S:h,tbtFinal:h},w=function(n,t){return _[n]?t<=_[n][0]?"good":t<=_[n][1]?"needsImprovement":"poor":null},F=function(e,i,o){var a;a=function(){v.u&&e.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:e,data:i,eventProperties:o||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:c()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(f,s)}:{},vitalsScore:w(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(a,{timeout:3e3}):a()},E=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),F(n,t,e)},S=function(t,e,i){var r=p(t);r<=n.o&&r>=0&&F(e,r,i)},x={},D={value:0},I={value:0},P={value:0},j={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},q={value:0},C=function(n){var t=n.pop();t&&!t.s&&t.value&&(D.value+=t.value)},L={},O=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},W=function(n){L[n]&&L[n].disconnect(),delete L[n]},B=function(n){var t=n.pop();t&&(S(t.processingStart-t.startTime,"fidVitals",{performanceEntry:t}),S(t.duration,"fid",{performanceEntry:t})),W(1),S(P.value,"lcp"),L[3]&&"function"==typeof L[3].takeRecords&&L[3].takeRecords(),S(D.value,"cls"),S(q.value,"tbt"),setTimeout((function(){S(q.value,"tbt5S")}),5e3),setTimeout((function(){S(q.value,"tbt10S"),E("dataConsumption",j.value)}),1e4)},M=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<I.value)){var t=n.duration-50;t>0&&(q.value+=t)}}))},V=function(n){n.forEach((function(n){"first-paint"===n.name?S(n.startTime,"fp"):"first-contentful-paint"===n.name&&(I.value=n.startTime,S(I.value,"fcp"),L[4]=O("longtask",M),W(0))}))},z=function(n){var t=n.pop();t&&(P.value=t.renderTime||t.loadTime)},H=function(n){n.forEach((function(n){n.identifier&&S(n.startTime,n.identifier)}))},N=function(t){t.forEach((function(t){if(n.t&&E("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;j.value[t.initiatorType]+=e,j.value.total+=e}}))},R=function(){L[2]&&(S(P.value,"lcpFinal"),W(2)),L[3]&&("function"==typeof L[3].takeRecords&&L[3].takeRecords(),S(D.value,"clsFinal"),W(3)),L[4]&&(S(q.value,"tbtFinal"),W(4))},A=function(n){var t="usageDetails"in n?n.usageDetails:{};E("storageEstimate",{quota:g(n.quota),usage:g(n.usage),caches:g(t.caches),indexedDB:g(t.indexedDB),serviceWorker:g(t.serviceWorkerRegistrations)})},G=function(){function e(e){void 0===e&&(e={}),this.l="5.3.0",n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=!!e.elementTiming,n.o=e.maxMeasureTime||n.o,a()&&("PerformanceObserver"in t&&(L[0]=O("paint",V),L[1]=O("first-input",B),L[2]=O("largest-contentful-paint",z),n.t&&O("resource",N),L[3]=O("layout-shift",C),n.i&&O("element",H)),void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,R)),E("navigationTiming",function(){if(!a())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}()),E("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(f=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&"function"==typeof r.storage.estimate&&r.storage.estimate().then(A))}return e.prototype.start=function(n){a()&&!x[n]&&(x[n]=!0,o.mark("mark_"+n+"_start"),v.u=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),a()&&x[n]&&(o.mark("mark_"+n+"_end"),delete x[n],E(n,p(function(n){o.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var t=o.getEntriesByName(n).pop();return t&&"measure"===t.entryType?t.duration:-1}(n)),t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete x[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}();export default G; | ||
var n={t:!1,i:!1,o:3e4},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},c=function(){return r.hardwareConcurrency},a=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},f="4g",s=!1,l=function(){return!!(c()&&c()<=4)||!!(u()&&u()<=4)},m=function(n,t){switch(n){case"slow-2g":case"2g":case"3g":return!0;default:return l()||t}},v={u:!1},d=function(n){i.hidden&&(n(),v.u=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},g=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},h=[2e3,4e3],k=[2500,4e3],y=[.1,.25],b={s:[200,500],fp:h,fcp:h,lcp:k,lcpFinal:k,fid:[100,300],cls:y,clsFinal:y,tbt:[300,600]},T=function(n,t){return b[n]?t<=b[n][0]?"good":t<=b[n][1]?"needsImprovement":"poor":null},w=function(e,i,o){var a;a=function(){v.u&&e.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:e,data:i,eventProperties:o||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:c()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(f,s)}:{},vitalsScore:T(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(a,{timeout:3e3}):a()},_=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),w(n,t,e)},F=function(t,e,i){var r=p(t);r<=n.o&&r>=0&&w(e,r,i)},E={},x={value:0},D={value:0},I={value:0},P={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},j={value:0},q=function(n){var t=n.pop();t&&!t.l&&t.value&&(x.value+=t.value)},C={},L=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},O=function(n){C[n]&&C[n].disconnect(),delete C[n]},S=function(n){var t=n.pop();t&&F(t.processingStart-t.startTime,"fid",{performanceEntry:t}),O(1),F(I.value,"lcp"),C[3]&&"function"==typeof C[3].takeRecords&&C[3].takeRecords(),F(x.value,"cls"),setTimeout((function(){F(j.value,"tbt"),_("dataConsumption",P.value)}),1e4)},W=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<D.value)){var t=n.duration-50;t>0&&(j.value+=t)}}))},B=function(n){n.forEach((function(n){"first-paint"===n.name?F(n.startTime,"fp"):"first-contentful-paint"===n.name&&(D.value=n.startTime,F(D.value,"fcp"),C[4]=L("longtask",W),O(0))}))},M=function(n){var t=n.pop();t&&(I.value=t.renderTime||t.loadTime)},z=function(n){n.forEach((function(n){n.identifier&&F(n.startTime,n.identifier)}))},H=function(t){t.forEach((function(t){if(n.t&&_("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;P.value[t.initiatorType]+=e,P.value.total+=e}}))},N=function(){C[2]&&(F(I.value,"lcpFinal"),O(2)),C[3]&&("function"==typeof C[3].takeRecords&&C[3].takeRecords(),F(x.value,"clsFinal"),O(3))},R=function(n){var t="usageDetails"in n?n.usageDetails:{};_("storageEstimate",{quota:g(n.quota),usage:g(n.usage),caches:g(t.caches),indexedDB:g(t.indexedDB),serviceWorker:g(t.serviceWorkerRegistrations)})},A=function(){function e(e){if(void 0===e&&(e={}),this.m="6.0.0",n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=!!e.elementTiming,n.o=e.maxMeasureTime||n.o,a()){"PerformanceObserver"in t&&(C[0]=L("paint",B),C[1]=L("first-input",S),C[2]=L("largest-contentful-paint",M),n.t&&L("resource",H),C[3]=L("layout-shift",q),n.i&&L("element",z)),void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,N));var u=function(){if(!a())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}();_("navigationTiming",u),u.timeToFirstByte&&F(u.timeToFirstByte,"ttfb"),_("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(f=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&"function"==typeof r.storage.estimate&&r.storage.estimate().then(R)}}return e.prototype.start=function(n){a()&&!E[n]&&(E[n]=!0,o.mark("mark_"+n+"_start"),v.u=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),a()&&E[n]&&(o.mark("mark_"+n+"_end"),delete E[n],_(n,p(function(n){o.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var t=o.getEntriesByName(n).pop();return t&&"measure"===t.entryType?t.duration:-1}(n)),t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete E[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}();export default A; | ||
//# sourceMappingURL=perfume.esm.min.js.map |
@@ -1,2 +0,2 @@ | ||
var Perfume=function(){"use strict";var n={t:!1,i:!1,o:15e3},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},c=function(){return r.hardwareConcurrency},a=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},f="4g",s=!1,l=function(){return!!(c()&&c()<=4)||!!(u()&&u()<=4)},m=function(n,t){return!!l()||(!!["slow-2g","2g","3g"].includes(n)||!!t)},v={u:!1},d=function(n){i.hidden&&(n(),v.u=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},g=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},b=[1e3,2500],y=[2500,4e3],k=[100,300],T=[.1,.25],h=[300,600],_={fp:b,fcp:b,lcp:y,lcpFinal:y,fid:k,fidVitals:k,cls:T,clsFinal:T,tbt:h,tbt5S:h,tbt10S:h,tbtFinal:h},w=function(n,t){return _[n]?t<=_[n][0]?"good":t<=_[n][1]?"needsImprovement":"poor":null},F=function(e,i,o){var a;a=function(){v.u&&e.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:e,data:i,eventProperties:o||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:c()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(f,s)}:{},vitalsScore:w(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(a,{timeout:3e3}):a()},E=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),F(n,t,e)},S=function(t,e,i){var r=p(t);r<=n.o&&r>=0&&F(e,r,i)},P={},x={value:0},D={value:0},I={value:0},j={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},q={value:0},C=function(n){var t=n.pop();t&&!t.s&&t.value&&(x.value+=t.value)},L={},O=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},W=function(n){L[n]&&L[n].disconnect(),delete L[n]},B=function(n){var t=n.pop();t&&(S(t.processingStart-t.startTime,"fidVitals",{performanceEntry:t}),S(t.duration,"fid",{performanceEntry:t})),W(1),S(I.value,"lcp"),L[3]&&"function"==typeof L[3].takeRecords&&L[3].takeRecords(),S(x.value,"cls"),S(q.value,"tbt"),setTimeout((function(){S(q.value,"tbt5S")}),5e3),setTimeout((function(){S(q.value,"tbt10S"),E("dataConsumption",j.value)}),1e4)},M=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<D.value)){var t=n.duration-50;t>0&&(q.value+=t)}}))},V=function(n){n.forEach((function(n){"first-paint"===n.name?S(n.startTime,"fp"):"first-contentful-paint"===n.name&&(D.value=n.startTime,S(D.value,"fcp"),L[4]=O("longtask",M),W(0))}))},z=function(n){var t=n.pop();t&&(I.value=t.renderTime||t.loadTime)},H=function(n){n.forEach((function(n){n.identifier&&S(n.startTime,n.identifier)}))},N=function(t){t.forEach((function(t){if(n.t&&E("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;j.value[t.initiatorType]+=e,j.value.total+=e}}))},R=function(){L[2]&&(S(I.value,"lcpFinal"),W(2)),L[3]&&("function"==typeof L[3].takeRecords&&L[3].takeRecords(),S(x.value,"clsFinal"),W(3)),L[4]&&(S(q.value,"tbtFinal"),W(4))},A=function(n){var t="usageDetails"in n?n.usageDetails:{};E("storageEstimate",{quota:g(n.quota),usage:g(n.usage),caches:g(t.caches),indexedDB:g(t.indexedDB),serviceWorker:g(t.serviceWorkerRegistrations)})};return function(){function e(e){void 0===e&&(e={}),this.l="5.3.0",n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=!!e.elementTiming,n.o=e.maxMeasureTime||n.o,a()&&("PerformanceObserver"in t&&(L[0]=O("paint",V),L[1]=O("first-input",B),L[2]=O("largest-contentful-paint",z),n.t&&O("resource",N),L[3]=O("layout-shift",C),n.i&&O("element",H)),void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,R)),E("navigationTiming",function(){if(!a())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}()),E("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(f=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&"function"==typeof r.storage.estimate&&r.storage.estimate().then(A))}return e.prototype.start=function(n){a()&&!P[n]&&(P[n]=!0,o.mark("mark_"+n+"_start"),v.u=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),a()&&P[n]&&(o.mark("mark_"+n+"_end"),delete P[n],E(n,p(function(n){o.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var t=o.getEntriesByName(n).pop();return t&&"measure"===t.entryType?t.duration:-1}(n)),t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete P[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}()}(); | ||
var Perfume=function(){"use strict";var n={t:!1,i:!1,o:3e4},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},c=function(){return r.hardwareConcurrency},a=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},f="4g",s=!1,l=function(){return!!(c()&&c()<=4)||!!(u()&&u()<=4)},m=function(n,t){switch(n){case"slow-2g":case"2g":case"3g":return!0;default:return l()||t}},v={u:!1},d=function(n){i.hidden&&(n(),v.u=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},g=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},h=[2e3,4e3],k=[2500,4e3],y=[.1,.25],b={s:[200,500],fp:h,fcp:h,lcp:k,lcpFinal:k,fid:[100,300],cls:y,clsFinal:y,tbt:[300,600]},T=function(n,t){return b[n]?t<=b[n][0]?"good":t<=b[n][1]?"needsImprovement":"poor":null},w=function(e,i,o){var a;a=function(){v.u&&e.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:e,data:i,eventProperties:o||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:c()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(f,s)}:{},vitalsScore:T(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(a,{timeout:3e3}):a()},_=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),w(n,t,e)},F=function(t,e,i){var r=p(t);r<=n.o&&r>=0&&w(e,r,i)},E={},P={value:0},x={value:0},D={value:0},I={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},j={value:0},q=function(n){var t=n.pop();t&&!t.l&&t.value&&(P.value+=t.value)},C={},L=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},O=function(n){C[n]&&C[n].disconnect(),delete C[n]},S=function(n){var t=n.pop();t&&F(t.processingStart-t.startTime,"fid",{performanceEntry:t}),O(1),F(D.value,"lcp"),C[3]&&"function"==typeof C[3].takeRecords&&C[3].takeRecords(),F(P.value,"cls"),setTimeout((function(){F(j.value,"tbt"),_("dataConsumption",I.value)}),1e4)},W=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<x.value)){var t=n.duration-50;t>0&&(j.value+=t)}}))},B=function(n){n.forEach((function(n){"first-paint"===n.name?F(n.startTime,"fp"):"first-contentful-paint"===n.name&&(x.value=n.startTime,F(x.value,"fcp"),C[4]=L("longtask",W),O(0))}))},M=function(n){var t=n.pop();t&&(D.value=t.renderTime||t.loadTime)},z=function(n){n.forEach((function(n){n.identifier&&F(n.startTime,n.identifier)}))},H=function(t){t.forEach((function(t){if(n.t&&_("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;I.value[t.initiatorType]+=e,I.value.total+=e}}))},N=function(){C[2]&&(F(D.value,"lcpFinal"),O(2)),C[3]&&("function"==typeof C[3].takeRecords&&C[3].takeRecords(),F(P.value,"clsFinal"),O(3))},R=function(n){var t="usageDetails"in n?n.usageDetails:{};_("storageEstimate",{quota:g(n.quota),usage:g(n.usage),caches:g(t.caches),indexedDB:g(t.indexedDB),serviceWorker:g(t.serviceWorkerRegistrations)})};return function(){function e(e){if(void 0===e&&(e={}),this.m="6.0.0",n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=!!e.elementTiming,n.o=e.maxMeasureTime||n.o,a()){"PerformanceObserver"in t&&(C[0]=L("paint",B),C[1]=L("first-input",S),C[2]=L("largest-contentful-paint",M),n.t&&L("resource",H),C[3]=L("layout-shift",q),n.i&&L("element",z)),void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,N));var u=function(){if(!a())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}();_("navigationTiming",u),u.timeToFirstByte&&F(u.timeToFirstByte,"ttfb"),_("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(f=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&"function"==typeof r.storage.estimate&&r.storage.estimate().then(R)}}return e.prototype.start=function(n){a()&&!E[n]&&(E[n]=!0,o.mark("mark_"+n+"_start"),v.u=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),a()&&E[n]&&(o.mark("mark_"+n+"_end"),delete E[n],_(n,p(function(n){o.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var t=o.getEntriesByName(n).pop();return t&&"measure"===t.entryType?t.duration:-1}(n)),t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete E[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}()}(); | ||
//# sourceMappingURL=perfume.iife.min.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var n={t:!1,i:!1,o:15e3},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},c=function(){return r.hardwareConcurrency},a=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},f="4g",s=!1,l=function(){return!!(c()&&c()<=4)||!!(u()&&u()<=4)},m=function(n,t){return!!l()||(!!["slow-2g","2g","3g"].includes(n)||!!t)},v={u:!1},d=function(n){i.hidden&&(n(),v.u=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},g=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},b=[1e3,2500],y=[2500,4e3],k=[100,300],T=[.1,.25],h=[300,600],_={fp:b,fcp:b,lcp:y,lcpFinal:y,fid:k,fidVitals:k,cls:T,clsFinal:T,tbt:h,tbt5S:h,tbt10S:h,tbtFinal:h},w=function(n,t){return _[n]?t<=_[n][0]?"good":t<=_[n][1]?"needsImprovement":"poor":null},F=function(e,i,o){var a;a=function(){v.u&&e.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:e,data:i,eventProperties:o||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:c()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(f,s)}:{},vitalsScore:w(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(a,{timeout:3e3}):a()},E=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),F(n,t,e)},S=function(t,e,i){var r=p(t);r<=n.o&&r>=0&&F(e,r,i)},x={},D={value:0},I={value:0},P={value:0},j={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},q={value:0},C=function(n){var t=n.pop();t&&!t.s&&t.value&&(D.value+=t.value)},L={},O=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},W=function(n){L[n]&&L[n].disconnect(),delete L[n]},B=function(n){var t=n.pop();t&&(S(t.processingStart-t.startTime,"fidVitals",{performanceEntry:t}),S(t.duration,"fid",{performanceEntry:t})),W(1),S(P.value,"lcp"),L[3]&&"function"==typeof L[3].takeRecords&&L[3].takeRecords(),S(D.value,"cls"),S(q.value,"tbt"),setTimeout((function(){S(q.value,"tbt5S")}),5e3),setTimeout((function(){S(q.value,"tbt10S"),E("dataConsumption",j.value)}),1e4)},M=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<I.value)){var t=n.duration-50;t>0&&(q.value+=t)}}))},V=function(n){n.forEach((function(n){"first-paint"===n.name?S(n.startTime,"fp"):"first-contentful-paint"===n.name&&(I.value=n.startTime,S(I.value,"fcp"),L[4]=O("longtask",M),W(0))}))},z=function(n){var t=n.pop();t&&(P.value=t.renderTime||t.loadTime)},H=function(n){n.forEach((function(n){n.identifier&&S(n.startTime,n.identifier)}))},N=function(t){t.forEach((function(t){if(n.t&&E("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;j.value[t.initiatorType]+=e,j.value.total+=e}}))},R=function(){L[2]&&(S(P.value,"lcpFinal"),W(2)),L[3]&&("function"==typeof L[3].takeRecords&&L[3].takeRecords(),S(D.value,"clsFinal"),W(3)),L[4]&&(S(q.value,"tbtFinal"),W(4))},A=function(n){var t="usageDetails"in n?n.usageDetails:{};E("storageEstimate",{quota:g(n.quota),usage:g(n.usage),caches:g(t.caches),indexedDB:g(t.indexedDB),serviceWorker:g(t.serviceWorkerRegistrations)})},G=function(){function e(e){void 0===e&&(e={}),this.l="5.3.0",n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=!!e.elementTiming,n.o=e.maxMeasureTime||n.o,a()&&("PerformanceObserver"in t&&(L[0]=O("paint",V),L[1]=O("first-input",B),L[2]=O("largest-contentful-paint",z),n.t&&O("resource",N),L[3]=O("layout-shift",C),n.i&&O("element",H)),void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,R)),E("navigationTiming",function(){if(!a())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}()),E("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(f=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&"function"==typeof r.storage.estimate&&r.storage.estimate().then(A))}return e.prototype.start=function(n){a()&&!x[n]&&(x[n]=!0,o.mark("mark_"+n+"_start"),v.u=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),a()&&x[n]&&(o.mark("mark_"+n+"_end"),delete x[n],E(n,p(function(n){o.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var t=o.getEntriesByName(n).pop();return t&&"measure"===t.entryType?t.duration:-1}(n)),t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete x[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}();module.exports=G; | ||
"use strict";var n={t:!1,i:!1,o:3e4},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},c=function(){return r.hardwareConcurrency},a=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},f="4g",s=!1,l=function(){return!!(c()&&c()<=4)||!!(u()&&u()<=4)},m=function(n,t){switch(n){case"slow-2g":case"2g":case"3g":return!0;default:return l()||t}},v={u:!1},d=function(n){i.hidden&&(n(),v.u=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},g=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},h=[2e3,4e3],k=[2500,4e3],y=[.1,.25],b={s:[200,500],fp:h,fcp:h,lcp:k,lcpFinal:k,fid:[100,300],cls:y,clsFinal:y,tbt:[300,600]},T=function(n,t){return b[n]?t<=b[n][0]?"good":t<=b[n][1]?"needsImprovement":"poor":null},w=function(e,i,o){var a;a=function(){v.u&&e.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:e,data:i,eventProperties:o||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:c()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(f,s)}:{},vitalsScore:T(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(a,{timeout:3e3}):a()},_=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),w(n,t,e)},F=function(t,e,i){var r=p(t);r<=n.o&&r>=0&&w(e,r,i)},E={},x={value:0},D={value:0},I={value:0},P={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},j={value:0},q=function(n){var t=n.pop();t&&!t.l&&t.value&&(x.value+=t.value)},C={},L=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},O=function(n){C[n]&&C[n].disconnect(),delete C[n]},S=function(n){var t=n.pop();t&&F(t.processingStart-t.startTime,"fid",{performanceEntry:t}),O(1),F(I.value,"lcp"),C[3]&&"function"==typeof C[3].takeRecords&&C[3].takeRecords(),F(x.value,"cls"),setTimeout((function(){F(j.value,"tbt"),_("dataConsumption",P.value)}),1e4)},W=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<D.value)){var t=n.duration-50;t>0&&(j.value+=t)}}))},B=function(n){n.forEach((function(n){"first-paint"===n.name?F(n.startTime,"fp"):"first-contentful-paint"===n.name&&(D.value=n.startTime,F(D.value,"fcp"),C[4]=L("longtask",W),O(0))}))},M=function(n){var t=n.pop();t&&(I.value=t.renderTime||t.loadTime)},z=function(n){n.forEach((function(n){n.identifier&&F(n.startTime,n.identifier)}))},H=function(t){t.forEach((function(t){if(n.t&&_("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;P.value[t.initiatorType]+=e,P.value.total+=e}}))},N=function(){C[2]&&(F(I.value,"lcpFinal"),O(2)),C[3]&&("function"==typeof C[3].takeRecords&&C[3].takeRecords(),F(x.value,"clsFinal"),O(3))},R=function(n){var t="usageDetails"in n?n.usageDetails:{};_("storageEstimate",{quota:g(n.quota),usage:g(n.usage),caches:g(t.caches),indexedDB:g(t.indexedDB),serviceWorker:g(t.serviceWorkerRegistrations)})},A=function(){function e(e){if(void 0===e&&(e={}),this.m="6.0.0",n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=!!e.elementTiming,n.o=e.maxMeasureTime||n.o,a()){"PerformanceObserver"in t&&(C[0]=L("paint",B),C[1]=L("first-input",S),C[2]=L("largest-contentful-paint",M),n.t&&L("resource",H),C[3]=L("layout-shift",q),n.i&&L("element",z)),void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,N));var u=function(){if(!a())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}();_("navigationTiming",u),u.timeToFirstByte&&F(u.timeToFirstByte,"ttfb"),_("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(f=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&"function"==typeof r.storage.estimate&&r.storage.estimate().then(R)}}return e.prototype.start=function(n){a()&&!E[n]&&(E[n]=!0,o.mark("mark_"+n+"_start"),v.u=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),a()&&E[n]&&(o.mark("mark_"+n+"_end"),delete E[n],_(n,p(function(n){o.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var t=o.getEntriesByName(n).pop();return t&&"measure"===t.entryType?t.duration:-1}(n)),t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete E[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}();module.exports=A; | ||
//# sourceMappingURL=perfume.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n=n||self).Perfume=t()}(this,(function(){"use strict";var n={t:!1,i:!1,o:15e3},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},c=function(){return r.hardwareConcurrency},f=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},a="4g",s=!1,l=function(){return!!(c()&&c()<=4)||!!(u()&&u()<=4)},m=function(n,t){return!!l()||(!!["slow-2g","2g","3g"].includes(n)||!!t)},d={u:!1},p=function(n){i.hidden&&(n(),d.u=i.hidden)},v=function(n){return parseFloat(n.toFixed(2))},b=function(n){return"number"!=typeof n?null:v(n/Math.pow(1024,2))},g=[1e3,2500],y=[2500,4e3],h=[100,300],k=[.1,.25],T=[300,600],_={fp:g,fcp:g,lcp:y,lcpFinal:y,fid:h,fidVitals:h,cls:k,clsFinal:k,tbt:T,tbt5S:T,tbt10S:T,tbtFinal:T},w=function(n,t){return _[n]?t<=_[n][0]?"good":t<=_[n][1]?"needsImprovement":"poor":null},F=function(e,i,o){var f;f=function(){d.u&&e.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:e,data:i,eventProperties:o||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:c()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(a,s)}:{},vitalsScore:w(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(f,{timeout:3e3}):f()},E=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=v(t[n]))})),F(n,t,e)},S=function(t,e,i){var r=v(t);r<=n.o&&r>=0&&F(e,r,i)},x={},j={value:0},D={value:0},I={value:0},P={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},q={value:0},C=function(n){var t=n.pop();t&&!t.s&&t.value&&(j.value+=t.value)},L={},O=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},W=function(n){L[n]&&L[n].disconnect(),delete L[n]},B=function(n){var t=n.pop();t&&(S(t.processingStart-t.startTime,"fidVitals",{performanceEntry:t}),S(t.duration,"fid",{performanceEntry:t})),W(1),S(I.value,"lcp"),L[3]&&"function"==typeof L[3].takeRecords&&L[3].takeRecords(),S(j.value,"cls"),S(q.value,"tbt"),setTimeout((function(){S(q.value,"tbt5S")}),5e3),setTimeout((function(){S(q.value,"tbt10S"),E("dataConsumption",P.value)}),1e4)},M=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<D.value)){var t=n.duration-50;t>0&&(q.value+=t)}}))},V=function(n){n.forEach((function(n){"first-paint"===n.name?S(n.startTime,"fp"):"first-contentful-paint"===n.name&&(D.value=n.startTime,S(D.value,"fcp"),L[4]=O("longtask",M),W(0))}))},z=function(n){var t=n.pop();t&&(I.value=t.renderTime||t.loadTime)},H=function(n){n.forEach((function(n){n.identifier&&S(n.startTime,n.identifier)}))},N=function(t){t.forEach((function(t){if(n.t&&E("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;P.value[t.initiatorType]+=e,P.value.total+=e}}))},R=function(){L[2]&&(S(I.value,"lcpFinal"),W(2)),L[3]&&("function"==typeof L[3].takeRecords&&L[3].takeRecords(),S(j.value,"clsFinal"),W(3)),L[4]&&(S(q.value,"tbtFinal"),W(4))},A=function(n){var t="usageDetails"in n?n.usageDetails:{};E("storageEstimate",{quota:b(n.quota),usage:b(n.usage),caches:b(t.caches),indexedDB:b(t.indexedDB),serviceWorker:b(t.serviceWorkerRegistrations)})};return function(){function e(e){void 0===e&&(e={}),this.l="5.3.0",n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=!!e.elementTiming,n.o=e.maxMeasureTime||n.o,f()&&("PerformanceObserver"in t&&(L[0]=O("paint",V),L[1]=O("first-input",B),L[2]=O("largest-contentful-paint",z),n.t&&O("resource",N),L[3]=O("layout-shift",C),n.i&&O("element",H)),void 0!==i.hidden&&i.addEventListener("visibilitychange",p.bind(this,R)),E("navigationTiming",function(){if(!f())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}()),E("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(a=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&"function"==typeof r.storage.estimate&&r.storage.estimate().then(A))}return e.prototype.start=function(n){f()&&!x[n]&&(x[n]=!0,o.mark("mark_"+n+"_start"),d.u=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),f()&&x[n]&&(o.mark("mark_"+n+"_end"),delete x[n],E(n,v(function(n){o.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var t=o.getEntriesByName(n).pop();return t&&"measure"===t.entryType?t.duration:-1}(n)),t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete x[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}()})); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n=n||self).Perfume=e()}(this,(function(){"use strict";var n={t:!1,i:!1,o:3e4},e=window,t=e.console,i=document,r=e.navigator,o=e.performance,u=function(){return r.deviceMemory},c=function(){return r.hardwareConcurrency},f=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},a="4g",s=!1,l=function(){return!!(c()&&c()<=4)||!!(u()&&u()<=4)},m=function(n,e){switch(n){case"slow-2g":case"2g":case"3g":return!0;default:return l()||e}},d={u:!1},v=function(n){i.hidden&&(n(),d.u=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},g=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},y=[2e3,4e3],h=[2500,4e3],b=[.1,.25],k={s:[200,500],fp:y,fcp:y,lcp:h,lcpFinal:h,fid:[100,300],cls:b,clsFinal:b,tbt:[300,600]},T=function(n,e){return k[n]?e<=k[n][0]?"good":e<=k[n][1]?"needsImprovement":"poor":null},w=function(t,i,o){var f;f=function(){d.u&&t.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:t,data:i,eventProperties:o||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:c()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(a,s)}:{},vitalsScore:T(t,i)})},"requestIdleCallback"in e?e.requestIdleCallback(f,{timeout:3e3}):f()},_=function(n,e,t){Object.keys(e).forEach((function(n){"number"==typeof e[n]&&(e[n]=p(e[n]))})),w(n,e,t)},F=function(e,t,i){var r=p(e);r<=n.o&&r>=0&&w(t,r,i)},E={},x={value:0},j={value:0},D={value:0},I={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},P={value:0},q=function(n){var e=n.pop();e&&!e.l&&e.value&&(x.value+=e.value)},C={},L=function(n,e){try{var i=new PerformanceObserver((function(n){e(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){t.warn("Perfume.js:",n)}return null},O=function(n){C[n]&&C[n].disconnect(),delete C[n]},S=function(n){var e=n.pop();e&&F(e.processingStart-e.startTime,"fid",{performanceEntry:e}),O(1),F(D.value,"lcp"),C[3]&&"function"==typeof C[3].takeRecords&&C[3].takeRecords(),F(x.value,"cls"),setTimeout((function(){F(P.value,"tbt"),_("dataConsumption",I.value)}),1e4)},W=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<j.value)){var e=n.duration-50;e>0&&(P.value+=e)}}))},B=function(n){n.forEach((function(n){"first-paint"===n.name?F(n.startTime,"fp"):"first-contentful-paint"===n.name&&(j.value=n.startTime,F(j.value,"fcp"),C[4]=L("longtask",W),O(0))}))},M=function(n){var e=n.pop();e&&(D.value=e.renderTime||e.loadTime)},z=function(n){n.forEach((function(n){n.identifier&&F(n.startTime,n.identifier)}))},H=function(e){e.forEach((function(e){if(n.t&&_("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;I.value[e.initiatorType]+=t,I.value.total+=t}}))},N=function(){C[2]&&(F(D.value,"lcpFinal"),O(2)),C[3]&&("function"==typeof C[3].takeRecords&&C[3].takeRecords(),F(x.value,"clsFinal"),O(3))},R=function(n){var e="usageDetails"in n?n.usageDetails:{};_("storageEstimate",{quota:g(n.quota),usage:g(n.usage),caches:g(e.caches),indexedDB:g(e.indexedDB),serviceWorker:g(e.serviceWorkerRegistrations)})};return function(){function t(t){if(void 0===t&&(t={}),this.m="6.0.0",n.analyticsTracker=t.analyticsTracker,n.t=!!t.resourceTiming,n.i=!!t.elementTiming,n.o=t.maxMeasureTime||n.o,f()){"PerformanceObserver"in e&&(C[0]=L("paint",B),C[1]=L("first-input",S),C[2]=L("largest-contentful-paint",M),n.t&&L("resource",H),C[3]=L("layout-shift",q),n.i&&L("element",z)),void 0!==i.hidden&&i.addEventListener("visibilitychange",v.bind(this,N));var u=function(){if(!f())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var e=n.responseStart,t=n.responseEnd;return{fetchTime:t-n.fetchStart,workerTime:n.workerStart>0?t-n.workerStart:0,totalTime:t-n.requestStart,downloadTime:t-e,timeToFirstByte:e-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}();_("navigationTiming",u),u.timeToFirstByte&&F(u.timeToFirstByte,"ttfb"),_("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(a=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&"function"==typeof r.storage.estimate&&r.storage.estimate().then(R)}}return t.prototype.start=function(n){f()&&!E[n]&&(E[n]=!0,o.mark("mark_"+n+"_start"),d.u=!1)},t.prototype.end=function(n,e){void 0===e&&(e={}),f()&&E[n]&&(o.mark("mark_"+n+"_end"),delete E[n],_(n,p(function(n){o.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var e=o.getEntriesByName(n).pop();return e&&"measure"===e.entryType?e.duration:-1}(n)),e))},t.prototype.endPaint=function(n,e){var t=this;setTimeout((function(){t.end(n,e)}))},t.prototype.clear=function(n){delete E[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},t}()})); | ||
//# sourceMappingURL=perfume.umd.min.js.map |
{ | ||
"name": "perfume.js", | ||
"version": "5.3.0", | ||
"version": "6.0.0", | ||
"description": "Web performance library for measuring all User-centric performance metrics, including the latest Web Vitals.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -6,3 +6,3 @@ <a href="http://www.perfumejs.com/"> | ||
# [Perfume.js v5.3.0](http://perfumejs.com) | ||
# [Perfume.js v6.0.0](http://perfumejs.com) | ||
@@ -18,3 +18,3 @@ [![Current version](https://img.shields.io/github/tag/zizzamia/perfume.js?color=3498DB&label=version)](https://www.npmjs.org/package/perfume.js) [![Test Coverage](https://api.codeclimate.com/v1/badges/f813d2f45b274d93b8c5/test_coverage)](https://codeclimate.com/github/Zizzamia/perfume.js/test_coverage) <img alt="No dependencies" src="https://img.shields.io/badge/dependencies-none-27ae60.svg"> [![Build Status](https://travis-ci.org/Zizzamia/perfume.js.svg?branch=master)](https://travis-ci.org/Zizzamia/perfume.js) [![NPM Downloads](http://img.shields.io/npm/dm/perfume.js.svg)](https://www.npmjs.org/package/perfume.js) [![gzip size](https://img.badgesize.io/https://unpkg.com/perfume.js?compression=gzip&label=JS+gzip+size)](https://unpkg.com/perfume.js) [![brotli size](https://img.badgesize.io/https://unpkg.com/perfume.js?compression=brotli&label=JS+brotli+size)](https://unpkg.com/perfume.js) | ||
English | [简体中文](./README-zh_CN.md) | [Italian](./README-it.md) | ||
English | [简体中文](./README-zh_CN.md) | [Italian](./README-it.md) | [한국어](./README-ko.md) | ||
@@ -54,5 +54,5 @@ ## Why Perfume.js? | ||
<br /> | ||
With Perfume.js, you can collect these metrics to develop a deeper understanding of how customers around the world perceive web performance for your application. | ||
With Perfume.js, you can collect these metrics to develop a deeper understanding of how customers around the world perceive web performance for your application. | ||
<br /> | ||
Use your favorite analytics tool to visualize the data from country to country. | ||
Use your favorite analytics tool to visualize the data from country to country. | ||
Take a look at this example comparing <b>FCP</b> for www.coinbase.com in the United States, Italy, Indonesia, and Nigeria. | ||
@@ -115,2 +115,5 @@ <br /> | ||
break; | ||
case 'ttfb': | ||
myAnalyticsTool.track('ttfb', { duration: data }); | ||
break; | ||
case 'fp': | ||
@@ -142,5 +145,2 @@ myAnalyticsTool.track('firstPaint', { duration: data }); | ||
break; | ||
case 'tbt10S': | ||
myAnalyticsTool.track('totalBlockingTime10S', { duration: data }); | ||
break; | ||
case 'elPageTitle': | ||
@@ -243,9 +243,6 @@ myAnalyticsTool.track('elementTimingPageTitle', { duration: data }); | ||
We end the Total Blocking Time measure at four points: when First Input Delay happen, 5 seconds after FID, 10 seconds after FID and when the page's lifecycle state changes to hidden. | ||
We end the Total Blocking Time measure 10 seconds after FID. | ||
```javascript | ||
// Perfume.js: tbt 347.07 ms | ||
// Perfume.js: tbt5S 427.14 ms | ||
// Perfume.js: tbt10S 427.14 ms | ||
// Perfume.js: tbtFinal 526.08 ms | ||
``` | ||
@@ -335,4 +332,5 @@ | ||
| ----------------------------------------- | -----: | ----------------: | --------: | | ||
| Fist Paint (fp) | 0-1000 | 1001-2500 | Over 2500 | | ||
| First Contentful Paint (fcp) | 0-1000 | 1001-2500 | Over 2500 | | ||
| Time to First Byte (ttfb) | 0-200 | 201-500 | Over 500 | | ||
| Fist Paint (fp) | 0-2000 | 2001-4000 | Over 4000 | | ||
| First Contentful Paint (fcp) | 0-2000 | 2001-4000 | Over 4000 | | ||
| Largest Contentful Paint (lcp) | 0-2500 | 2501-4000 | Over 4000 | | ||
@@ -344,5 +342,2 @@ | Largest Contentful Paint Final (lcpFinal) | 0-2500 | 2501-4000 | Over 4000 | | ||
| Total Blocking Time (tbt) | 0-300 | 301-600 | Over 600 | | ||
| Total Blocking Time 5S (tbt5S) | 0-300 | 301-600 | Over 600 | | ||
| Total Blocking Time 10S (tbt5S) | 0-300 | 301-600 | Over 600 | | ||
| Total Blocking Time Final (tbtFinal) | 0-300 | 301-600 | Over 600 | | ||
@@ -358,3 +353,3 @@ ## Perfume custom options | ||
analyticsTracker: options => {}, | ||
maxMeasureTime: 15000, | ||
maxMeasureTime: 30000, | ||
}; | ||
@@ -370,3 +365,3 @@ ``` | ||
```javascript | ||
const metricNames = ['fp', 'fcp', 'lcp', 'lcpFinal', 'fid', 'cls', 'clsFinal', 'tbt', 'tbt10S', 'tbtFinal']; | ||
const metricNames = ['ttfb', 'fp', 'fcp', 'lcp', 'lcpFinal', 'fid', 'cls', 'clsFinal', 'tbt']; | ||
new Perfume({ | ||
@@ -443,3 +438,3 @@ analyticsTracker: ({ metricName, data, navigatorInformation }) => { | ||
Code and documentation copyright 2020 [Leonardo Zizzamia](https://twitter.com/Zizzamia). Code released under the [MIT license](LICENSE). Docs released under Creative Commons. | ||
Code and documentation copyright 2021 [Leonardo Zizzamia](https://twitter.com/Zizzamia). Code released under the [MIT license](LICENSE). Docs released under Creative Commons. | ||
@@ -446,0 +441,0 @@ ## Team |
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
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
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
269739
1532
445