perfume.js
Advanced tools
Comparing version
# Changelog | ||
## 5.2.0 (2020-8-26) | ||
* **fix:** conditionally make calls to PerformanceObserver.takeRecords which does not exist in Safari [#138](https://github.com/Zizzamia/perfume.js/pull/138) | ||
* **fix:** report CLS when value is 0 | ||
* **feat:** prepare new FID iteration for v6 | ||
* **chore:** Italian README [#137](https://github.com/Zizzamia/perfume.js/pull/137) | ||
## 5.1.1 (2020-8-12) | ||
@@ -4,0 +11,0 @@ |
import { logData, logMetric } from './log'; | ||
import { cls, lcp, rt, tbt } from './metrics'; | ||
import { perfObservers } from './observeInstances'; | ||
import { poDisconnect } from './performanceObserver'; | ||
import { perfObservers } from './observeInstances'; | ||
export var initFirstInputDelay = function (performanceEntries) { | ||
var lastEntry = performanceEntries.pop(); | ||
if (lastEntry) { | ||
// Core Web Vitals FID logic | ||
// Measure the delay to begin processing the first input event | ||
logMetric(lastEntry.processingStart - lastEntry.startTime, 'fidVitals'); | ||
// Legacy FID logic | ||
// Measure the duration of processing the first input event | ||
logMetric(lastEntry.duration, 'fid'); | ||
} | ||
// Disconnect this observer since callback is only triggered once | ||
poDisconnect(1); | ||
logMetric(lcp.value, 'lcp'); | ||
if (perfObservers[3]) { | ||
if (perfObservers[3] && typeof perfObservers[3].takeRecords === 'function') { | ||
perfObservers[3].takeRecords(); | ||
@@ -14,0 +20,0 @@ } |
@@ -19,3 +19,3 @@ import { config } from './config'; | ||
var duration2Decimal = roundByTwo(duration); | ||
if (duration2Decimal <= config.maxTime && duration2Decimal > 0) { | ||
if (duration2Decimal <= config.maxTime && duration2Decimal >= 0) { | ||
// Sends the metric to an external tracking service | ||
@@ -22,0 +22,0 @@ reportPerf(measureName, duration2Decimal); |
@@ -7,3 +7,3 @@ import { config } from './config'; | ||
import { perfObservers } from './observeInstances'; | ||
import { initFirstPaint, initLargestContentfulPaint, initElementTiming } from './paint'; | ||
import { initElementTiming, initFirstPaint, initLargestContentfulPaint, } from './paint'; | ||
import { po, poDisconnect } from './performanceObserver'; | ||
@@ -32,3 +32,5 @@ import { initResourceTiming } from './resourceTiming'; | ||
if (perfObservers[3]) { | ||
perfObservers[3].takeRecords(); | ||
if (typeof perfObservers[3].takeRecords === 'function') { | ||
perfObservers[3].takeRecords(); | ||
} | ||
logMetric(cls.value, "clsFinal"); | ||
@@ -35,0 +37,0 @@ poDisconnect(3); |
/*! | ||
* Perfume.js v5.1.0 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v5.2.0 (http://zizzamia.github.io/perfume) | ||
* Copyright 2020 Leonardo Zizzamia (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
@@ -22,3 +22,3 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
if (options === void 0) { options = {}; } | ||
this.v = '5.1.0'; | ||
this.v = '5.2.0'; | ||
// Extend default config with external options | ||
@@ -25,0 +25,0 @@ config.analyticsTracker = options.analyticsTracker; |
@@ -5,12 +5,18 @@ "use strict"; | ||
var metrics_1 = require("./metrics"); | ||
var observeInstances_1 = require("./observeInstances"); | ||
var performanceObserver_1 = require("./performanceObserver"); | ||
var observeInstances_1 = require("./observeInstances"); | ||
exports.initFirstInputDelay = function (performanceEntries) { | ||
var lastEntry = performanceEntries.pop(); | ||
if (lastEntry) { | ||
// Core Web Vitals FID logic | ||
// Measure the delay to begin processing the first input event | ||
log_1.logMetric(lastEntry.processingStart - lastEntry.startTime, 'fidVitals'); | ||
// Legacy FID logic | ||
// Measure the duration of processing the first input event | ||
log_1.logMetric(lastEntry.duration, 'fid'); | ||
} | ||
// Disconnect this observer since callback is only triggered once | ||
performanceObserver_1.poDisconnect(1); | ||
log_1.logMetric(metrics_1.lcp.value, 'lcp'); | ||
if (observeInstances_1.perfObservers[3]) { | ||
if (observeInstances_1.perfObservers[3] && typeof observeInstances_1.perfObservers[3].takeRecords === 'function') { | ||
observeInstances_1.perfObservers[3].takeRecords(); | ||
@@ -17,0 +23,0 @@ } |
@@ -21,3 +21,3 @@ "use strict"; | ||
var duration2Decimal = utils_1.roundByTwo(duration); | ||
if (duration2Decimal <= config_1.config.maxTime && duration2Decimal > 0) { | ||
if (duration2Decimal <= config_1.config.maxTime && duration2Decimal >= 0) { | ||
// Sends the metric to an external tracking service | ||
@@ -24,0 +24,0 @@ reportPerf_1.reportPerf(measureName, duration2Decimal); |
@@ -33,3 +33,5 @@ "use strict"; | ||
if (observeInstances_1.perfObservers[3]) { | ||
observeInstances_1.perfObservers[3].takeRecords(); | ||
if (typeof observeInstances_1.perfObservers[3].takeRecords === 'function') { | ||
observeInstances_1.perfObservers[3].takeRecords(); | ||
} | ||
log_1.logMetric(metrics_1.cls.value, "clsFinal"); | ||
@@ -36,0 +38,0 @@ performanceObserver_1.poDisconnect(3); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/*! | ||
* Perfume.js v5.1.0 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v5.2.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.1.0'; | ||
this.v = '5.2.0'; | ||
// Extend default config with external options | ||
@@ -27,0 +27,0 @@ config_1.config.analyticsTracker = options.analyticsTracker; |
@@ -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],k=[2500,4e3],T=[.1,.25],h=[300,600],y={fp:b,fcp:b,lcp:k,lcpFinal:k,fid:[100,300],cls:T,clsFinal:T,tbt:h,tbt5S:h,tbt10S:h,tbtFinal:h},_=function(n,t){return y[n]?t<=y[n][0]?"good":t<=y[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:_(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(a,{timeout:3e3}):a()},F=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),w(n,t,e)},S=function(t,e){var i=p(t);i<=n.o&&i>0&&w(e,i)},x={},E={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.s&&t.value&&(E.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]},W=function(n){var t=n.pop();t&&S(t.duration,"fid"),O(1),S(I.value,"lcp"),C[3]&&C[3].takeRecords(),S(E.value,"cls"),S(j.value,"tbt"),setTimeout((function(){S(j.value,"tbt5S")}),5e3),setTimeout((function(){S(j.value,"tbt10S"),F("dataConsumption",P.value)}),1e4)},B=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<D.value)){var t=n.duration-50;t>0&&(j.value+=t)}}))},M=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"),C[4]=L("longtask",B),O(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&&F("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;P.value[t.initiatorType]+=e,P.value.total+=e}}))},R=function(){C[2]&&(S(I.value,"lcpFinal"),O(2)),C[3]&&(C[3].takeRecords(),S(E.value,"clsFinal"),O(3)),C[4]&&(S(j.value,"tbtFinal"),O(4))},A=function(n){var t="usageDetails"in n?n.usageDetails:{};F("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.1.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",M),C[1]=L("first-input",W),C[2]=L("largest-contentful-paint",z),n.t&&L("resource",N),C[3]=L("layout-shift",q),n.i&&L("element",H)),void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,R)),F("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}}()),F("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],F(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: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],k=[2500,4e3],T=[.1,.25],h=[300,600],y={fp:b,fcp:b,lcp:k,lcpFinal:k,fid:[100,300],cls:T,clsFinal:T,tbt:h,tbt5S:h,tbt10S:h,tbtFinal:h},_=function(n,t){return y[n]?t<=y[n][0]?"good":t<=y[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:_(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(a,{timeout:3e3}):a()},F=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),w(n,t,e)},S=function(t,e){var i=p(t);i<=n.o&&i>=0&&w(e,i)},x={},E={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.s&&t.value&&(E.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]},W=function(n){var t=n.pop();t&&(S(t.l-t.startTime,"fidVitals"),S(t.duration,"fid")),O(1),S(I.value,"lcp"),C[3]&&"function"==typeof C[3].takeRecords&&C[3].takeRecords(),S(E.value,"cls"),S(j.value,"tbt"),setTimeout((function(){S(j.value,"tbt5S")}),5e3),setTimeout((function(){S(j.value,"tbt10S"),F("dataConsumption",P.value)}),1e4)},B=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<D.value)){var t=n.duration-50;t>0&&(j.value+=t)}}))},M=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"),C[4]=L("longtask",B),O(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&&F("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;P.value[t.initiatorType]+=e,P.value.total+=e}}))},R=function(){C[2]&&(S(I.value,"lcpFinal"),O(2)),C[3]&&("function"==typeof C[3].takeRecords&&C[3].takeRecords(),S(E.value,"clsFinal"),O(3)),C[4]&&(S(j.value,"tbtFinal"),O(4))},V=function(n){var t="usageDetails"in n?n.usageDetails:{};F("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){void 0===e&&(e={}),this.m="5.2.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",M),C[1]=L("first-input",W),C[2]=L("largest-contentful-paint",z),n.t&&L("resource",N),C[3]=L("layout-shift",q),n.i&&L("element",H)),void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,R)),F("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}}()),F("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(V))}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],F(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 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],k=[2500,4e3],T=[.1,.25],h=[300,600],y={fp:b,fcp:b,lcp:k,lcpFinal:k,fid:[100,300],cls:T,clsFinal:T,tbt:h,tbt5S:h,tbt10S:h,tbtFinal:h},_=function(n,t){return y[n]?t<=y[n][0]?"good":t<=y[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:_(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(a,{timeout:3e3}):a()},F=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),w(n,t,e)},S=function(t,e){var i=p(t);i<=n.o&&i>0&&w(e,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.s&&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]},W=function(n){var t=n.pop();t&&S(t.duration,"fid"),O(1),S(D.value,"lcp"),C[3]&&C[3].takeRecords(),S(P.value,"cls"),S(j.value,"tbt"),setTimeout((function(){S(j.value,"tbt5S")}),5e3),setTimeout((function(){S(j.value,"tbt10S"),F("dataConsumption",I.value)}),1e4)},B=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<x.value)){var t=n.duration-50;t>0&&(j.value+=t)}}))},M=function(n){n.forEach((function(n){"first-paint"===n.name?S(n.startTime,"fp"):"first-contentful-paint"===n.name&&(x.value=n.startTime,S(x.value,"fcp"),C[4]=L("longtask",B),O(0))}))},z=function(n){var t=n.pop();t&&(D.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&&F("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;I.value[t.initiatorType]+=e,I.value.total+=e}}))},R=function(){C[2]&&(S(D.value,"lcpFinal"),O(2)),C[3]&&(C[3].takeRecords(),S(P.value,"clsFinal"),O(3)),C[4]&&(S(j.value,"tbtFinal"),O(4))},A=function(n){var t="usageDetails"in n?n.usageDetails:{};F("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.1.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",M),C[1]=L("first-input",W),C[2]=L("largest-contentful-paint",z),n.t&&L("resource",N),C[3]=L("layout-shift",q),n.i&&L("element",H)),void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,R)),F("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}}()),F("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()&&!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],F(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}()}(); | ||
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],k=[2500,4e3],T=[.1,.25],h=[300,600],y={fp:b,fcp:b,lcp:k,lcpFinal:k,fid:[100,300],cls:T,clsFinal:T,tbt:h,tbt5S:h,tbt10S:h,tbtFinal:h},_=function(n,t){return y[n]?t<=y[n][0]?"good":t<=y[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:_(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(a,{timeout:3e3}):a()},F=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),w(n,t,e)},S=function(t,e){var i=p(t);i<=n.o&&i>=0&&w(e,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.s&&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]},W=function(n){var t=n.pop();t&&(S(t.l-t.startTime,"fidVitals"),S(t.duration,"fid")),O(1),S(D.value,"lcp"),C[3]&&"function"==typeof C[3].takeRecords&&C[3].takeRecords(),S(P.value,"cls"),S(j.value,"tbt"),setTimeout((function(){S(j.value,"tbt5S")}),5e3),setTimeout((function(){S(j.value,"tbt10S"),F("dataConsumption",I.value)}),1e4)},B=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<x.value)){var t=n.duration-50;t>0&&(j.value+=t)}}))},M=function(n){n.forEach((function(n){"first-paint"===n.name?S(n.startTime,"fp"):"first-contentful-paint"===n.name&&(x.value=n.startTime,S(x.value,"fcp"),C[4]=L("longtask",B),O(0))}))},z=function(n){var t=n.pop();t&&(D.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&&F("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;I.value[t.initiatorType]+=e,I.value.total+=e}}))},R=function(){C[2]&&(S(D.value,"lcpFinal"),O(2)),C[3]&&("function"==typeof C[3].takeRecords&&C[3].takeRecords(),S(P.value,"clsFinal"),O(3)),C[4]&&(S(j.value,"tbtFinal"),O(4))},V=function(n){var t="usageDetails"in n?n.usageDetails:{};F("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.m="5.2.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",M),C[1]=L("first-input",W),C[2]=L("largest-contentful-paint",z),n.t&&L("resource",N),C[3]=L("layout-shift",q),n.i&&L("element",H)),void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,R)),F("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}}()),F("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(V))}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],F(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 config={t:!1,i:!1,o:15e3},W=window,C=W.console,D=document,WN=W.navigator,WP=W.performance,getDM=function(){return WN.deviceMemory},getHC=function(){return WN.hardwareConcurrency},isPerformanceSupported=function(){return WP&&!!WP.getEntriesByType&&!!WP.now&&!!WP.mark},getNavigationTiming=function(){if(!isPerformanceSupported())return{};var e=WP.getEntriesByType("navigation")[0];if(!e)return{};var t=e.responseStart,r=e.responseEnd;return{fetchTime:r-e.fetchStart,workerTime:e.workerStart>0?r-e.workerStart:0,totalTime:r-e.requestStart,downloadTime:r-t,timeToFirstByte:t-e.requestStart,headerSize:e.transferSize-e.encodedBodySize||0,dnsLookupTime:e.domainLookupEnd-e.domainLookupStart}},et="4g",sd=!1,getNetworkInformation=function(){if("connection"in WN){var e=WN.connection;return"object"!=typeof e?{}:(et=e.effectiveType,sd=!!e.saveData,{downlink:e.downlink,effectiveType:e.effectiveType,rtt:e.rtt,saveData:!!e.saveData})}return{}},getIsLowEndDevice=function(){return!!(getHC()&&getHC()<=4)||!!(getDM()&&getDM()<=4)},getIsLowEndExperience=function(e,t){return!!getIsLowEndDevice()||(!!["slow-2g","2g","3g"].includes(e)||!!t)},getNavigatorInfo=function(){return WN?{deviceMemory:getDM()||0,hardwareConcurrency:getHC()||0,serviceWorkerStatus:"serviceWorker"in WN?WN.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:getIsLowEndDevice(),isLowEndExperience:getIsLowEndExperience(et,sd)}:{}},visibility={s:!1},didVisibilityChange=function(e){D.hidden&&(e(),visibility.s=D.hidden)},roundByTwo=function(e){return parseFloat(e.toFixed(2))},convertToKB=function(e){return"number"!=typeof e?null:roundByTwo(e/Math.pow(1024,2))},pushTask=function(e){"requestIdleCallback"in W?W.requestIdleCallback(e,{timeout:3e3}):e()},fcpScore=[1e3,2500],lcpScore=[2500,4e3],clsScore=[.1,.25],tbtScore=[300,600],webVitalsScore={fp:fcpScore,fcp:fcpScore,lcp:lcpScore,lcpFinal:lcpScore,fid:[100,300],cls:clsScore,clsFinal:clsScore,tbt:tbtScore,tbt5S:tbtScore,tbt10S:tbtScore,tbtFinal:tbtScore},getVitalsScore=function(e,t){return webVitalsScore[e]?t<=webVitalsScore[e][0]?"good":t<=webVitalsScore[e][1]?"needsImprovement":"poor":null},reportPerf=function(e,t,r){pushTask((function(){visibility.s&&e.indexOf("Final")<0||!config.analyticsTracker||config.analyticsTracker({metricName:e,data:t,eventProperties:r||{},navigatorInformation:getNavigatorInfo(),vitalsScore:getVitalsScore(e,t)})}))},logData=function(e,t,r){Object.keys(t).forEach((function(e){"number"==typeof t[e]&&(t[e]=roundByTwo(t[e]))})),reportPerf(e,t,r)},logMetric=function(e,t){var r=roundByTwo(e);r<=config.o&&r>0&&reportPerf(t,r)},performanceMeasure=function(e){WP.measure(e,"mark_"+e+"_start","mark_"+e+"_end");var t=WP.getEntriesByName(e).pop();return t&&"measure"===t.entryType?t.duration:-1},metrics={},cls={value:0},fcp={value:0},lcp={value:0},fcpEntryName="first-contentful-paint",rt={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},tbt={value:0},initLayoutShift=function(e){var t=e.pop();t&&!t.u&&t.value&&(cls.value+=t.value)},perfObservers={},po=function(e,t){try{var r=new PerformanceObserver((function(e){t(e.getEntries())}));return r.observe({type:e,buffered:!0}),r}catch(e){C.warn("Perfume.js:",e)}return null},poDisconnect=function(e){perfObservers[e]&&perfObservers[e].disconnect(),delete perfObservers[e]},initFirstInputDelay=function(e){var t=e.pop();t&&logMetric(t.duration,"fid"),poDisconnect(1),logMetric(lcp.value,"lcp"),perfObservers[3]&&perfObservers[3].takeRecords(),logMetric(cls.value,"cls"),logMetric(tbt.value,"tbt"),setTimeout((function(){logMetric(tbt.value,"tbt5S")}),5e3),setTimeout((function(){logMetric(tbt.value,"tbt10S"),logData("dataConsumption",rt.value)}),1e4)},initTotalBlockingTime=function(e){e.forEach((function(e){if(!("self"!==e.name||e.startTime<fcp.value)){var t=e.duration-50;t>0&&(tbt.value+=t)}}))},initFirstPaint=function(e){e.forEach((function(e){"first-paint"===e.name?logMetric(e.startTime,"fp"):e.name===fcpEntryName&&(fcp.value=e.startTime,logMetric(fcp.value,"fcp"),perfObservers[4]=po("longtask",initTotalBlockingTime),poDisconnect(0))}))},initLargestContentfulPaint=function(e){var t=e.pop();t&&(lcp.value=t.renderTime||t.loadTime)},initElementTiming=function(e){e.forEach((function(e){e.identifier&&logMetric(e.startTime,e.identifier)}))},initResourceTiming=function(e){e.forEach((function(e){if(config.t&&logData("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;rt.value[e.initiatorType]+=t,rt.value.total+=t}}))},initPerformanceObserver=function(){perfObservers[0]=po("paint",initFirstPaint),perfObservers[1]=po("first-input",initFirstInputDelay),perfObservers[2]=po("largest-contentful-paint",initLargestContentfulPaint),config.t&&po("resource",initResourceTiming),perfObservers[3]=po("layout-shift",initLayoutShift),config.i&&po("element",initElementTiming)},disconnectPerfObserversHidden=function(){perfObservers[2]&&(logMetric(lcp.value,"lcpFinal"),poDisconnect(2)),perfObservers[3]&&(perfObservers[3].takeRecords(),logMetric(cls.value,"clsFinal"),poDisconnect(3)),perfObservers[4]&&(logMetric(tbt.value,"tbtFinal"),poDisconnect(4))},reportStorageEstimate=function(e){var t="usageDetails"in e?e.usageDetails:{};logData("storageEstimate",{quota:convertToKB(e.quota),usage:convertToKB(e.usage),caches:convertToKB(t.caches),indexedDB:convertToKB(t.indexedDB),serviceWorker:convertToKB(t.serviceWorkerRegistrations)})},Perfume=function(){function e(e){void 0===e&&(e={}),this.l="5.1.0",config.analyticsTracker=e.analyticsTracker,config.t=!!e.resourceTiming,config.i=!!e.elementTiming,config.o=e.maxMeasureTime||config.o,isPerformanceSupported()&&("PerformanceObserver"in W&&initPerformanceObserver(),void 0!==D.hidden&&D.addEventListener("visibilitychange",didVisibilityChange.bind(this,disconnectPerfObserversHidden)),logData("navigationTiming",getNavigationTiming()),logData("networkInformation",getNetworkInformation()),WN&&WN.storage&&"function"==typeof WN.storage.estimate&&WN.storage.estimate().then(reportStorageEstimate))}return e.prototype.start=function(e){isPerformanceSupported()&&!metrics[e]&&(metrics[e]=!0,WP.mark("mark_"+e+"_start"),visibility.s=!1)},e.prototype.end=function(e,t){void 0===t&&(t={}),isPerformanceSupported()&&metrics[e]&&(WP.mark("mark_"+e+"_end"),delete metrics[e],logData(e,roundByTwo(performanceMeasure(e)),t))},e.prototype.endPaint=function(e,t){var r=this;setTimeout((function(){r.end(e,t)}))},e.prototype.clear=function(e){delete metrics[e],WP.clearMarks&&(WP.clearMarks("mark_"+e+"_start"),WP.clearMarks("mark_"+e+"_end"))},e}();module.exports=Perfume; | ||
"use strict";var config={t:!1,i:!1,o:15e3},W=window,C=W.console,D=document,WN=W.navigator,WP=W.performance,getDM=function(){return WN.deviceMemory},getHC=function(){return WN.hardwareConcurrency},isPerformanceSupported=function(){return WP&&!!WP.getEntriesByType&&!!WP.now&&!!WP.mark},getNavigationTiming=function(){if(!isPerformanceSupported())return{};var e=WP.getEntriesByType("navigation")[0];if(!e)return{};var t=e.responseStart,r=e.responseEnd;return{fetchTime:r-e.fetchStart,workerTime:e.workerStart>0?r-e.workerStart:0,totalTime:r-e.requestStart,downloadTime:r-t,timeToFirstByte:t-e.requestStart,headerSize:e.transferSize-e.encodedBodySize||0,dnsLookupTime:e.domainLookupEnd-e.domainLookupStart}},et="4g",sd=!1,getNetworkInformation=function(){if("connection"in WN){var e=WN.connection;return"object"!=typeof e?{}:(et=e.effectiveType,sd=!!e.saveData,{downlink:e.downlink,effectiveType:e.effectiveType,rtt:e.rtt,saveData:!!e.saveData})}return{}},getIsLowEndDevice=function(){return!!(getHC()&&getHC()<=4)||!!(getDM()&&getDM()<=4)},getIsLowEndExperience=function(e,t){return!!getIsLowEndDevice()||(!!["slow-2g","2g","3g"].includes(e)||!!t)},getNavigatorInfo=function(){return WN?{deviceMemory:getDM()||0,hardwareConcurrency:getHC()||0,serviceWorkerStatus:"serviceWorker"in WN?WN.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:getIsLowEndDevice(),isLowEndExperience:getIsLowEndExperience(et,sd)}:{}},visibility={s:!1},didVisibilityChange=function(e){D.hidden&&(e(),visibility.s=D.hidden)},roundByTwo=function(e){return parseFloat(e.toFixed(2))},convertToKB=function(e){return"number"!=typeof e?null:roundByTwo(e/Math.pow(1024,2))},pushTask=function(e){"requestIdleCallback"in W?W.requestIdleCallback(e,{timeout:3e3}):e()},fcpScore=[1e3,2500],lcpScore=[2500,4e3],clsScore=[.1,.25],tbtScore=[300,600],webVitalsScore={fp:fcpScore,fcp:fcpScore,lcp:lcpScore,lcpFinal:lcpScore,fid:[100,300],cls:clsScore,clsFinal:clsScore,tbt:tbtScore,tbt5S:tbtScore,tbt10S:tbtScore,tbtFinal:tbtScore},getVitalsScore=function(e,t){return webVitalsScore[e]?t<=webVitalsScore[e][0]?"good":t<=webVitalsScore[e][1]?"needsImprovement":"poor":null},reportPerf=function(e,t,r){pushTask((function(){visibility.s&&e.indexOf("Final")<0||!config.analyticsTracker||config.analyticsTracker({metricName:e,data:t,eventProperties:r||{},navigatorInformation:getNavigatorInfo(),vitalsScore:getVitalsScore(e,t)})}))},logData=function(e,t,r){Object.keys(t).forEach((function(e){"number"==typeof t[e]&&(t[e]=roundByTwo(t[e]))})),reportPerf(e,t,r)},logMetric=function(e,t){var r=roundByTwo(e);r<=config.o&&r>=0&&reportPerf(t,r)},performanceMeasure=function(e){WP.measure(e,"mark_"+e+"_start","mark_"+e+"_end");var t=WP.getEntriesByName(e).pop();return t&&"measure"===t.entryType?t.duration:-1},metrics={},cls={value:0},fcp={value:0},lcp={value:0},fcpEntryName="first-contentful-paint",rt={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},tbt={value:0},initLayoutShift=function(e){var t=e.pop();t&&!t.u&&t.value&&(cls.value+=t.value)},perfObservers={},po=function(e,t){try{var r=new PerformanceObserver((function(e){t(e.getEntries())}));return r.observe({type:e,buffered:!0}),r}catch(e){C.warn("Perfume.js:",e)}return null},poDisconnect=function(e){perfObservers[e]&&perfObservers[e].disconnect(),delete perfObservers[e]},initFirstInputDelay=function(e){var t=e.pop();t&&(logMetric(t.l-t.startTime,"fidVitals"),logMetric(t.duration,"fid")),poDisconnect(1),logMetric(lcp.value,"lcp"),perfObservers[3]&&"function"==typeof perfObservers[3].takeRecords&&perfObservers[3].takeRecords(),logMetric(cls.value,"cls"),logMetric(tbt.value,"tbt"),setTimeout((function(){logMetric(tbt.value,"tbt5S")}),5e3),setTimeout((function(){logMetric(tbt.value,"tbt10S"),logData("dataConsumption",rt.value)}),1e4)},initTotalBlockingTime=function(e){e.forEach((function(e){if(!("self"!==e.name||e.startTime<fcp.value)){var t=e.duration-50;t>0&&(tbt.value+=t)}}))},initFirstPaint=function(e){e.forEach((function(e){"first-paint"===e.name?logMetric(e.startTime,"fp"):e.name===fcpEntryName&&(fcp.value=e.startTime,logMetric(fcp.value,"fcp"),perfObservers[4]=po("longtask",initTotalBlockingTime),poDisconnect(0))}))},initLargestContentfulPaint=function(e){var t=e.pop();t&&(lcp.value=t.renderTime||t.loadTime)},initElementTiming=function(e){e.forEach((function(e){e.identifier&&logMetric(e.startTime,e.identifier)}))},initResourceTiming=function(e){e.forEach((function(e){if(config.t&&logData("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;rt.value[e.initiatorType]+=t,rt.value.total+=t}}))},initPerformanceObserver=function(){perfObservers[0]=po("paint",initFirstPaint),perfObservers[1]=po("first-input",initFirstInputDelay),perfObservers[2]=po("largest-contentful-paint",initLargestContentfulPaint),config.t&&po("resource",initResourceTiming),perfObservers[3]=po("layout-shift",initLayoutShift),config.i&&po("element",initElementTiming)},disconnectPerfObserversHidden=function(){perfObservers[2]&&(logMetric(lcp.value,"lcpFinal"),poDisconnect(2)),perfObservers[3]&&("function"==typeof perfObservers[3].takeRecords&&perfObservers[3].takeRecords(),logMetric(cls.value,"clsFinal"),poDisconnect(3)),perfObservers[4]&&(logMetric(tbt.value,"tbtFinal"),poDisconnect(4))},reportStorageEstimate=function(e){var t="usageDetails"in e?e.usageDetails:{};logData("storageEstimate",{quota:convertToKB(e.quota),usage:convertToKB(e.usage),caches:convertToKB(t.caches),indexedDB:convertToKB(t.indexedDB),serviceWorker:convertToKB(t.serviceWorkerRegistrations)})},Perfume=function(){function e(e){void 0===e&&(e={}),this.p="5.2.0",config.analyticsTracker=e.analyticsTracker,config.t=!!e.resourceTiming,config.i=!!e.elementTiming,config.o=e.maxMeasureTime||config.o,isPerformanceSupported()&&("PerformanceObserver"in W&&initPerformanceObserver(),void 0!==D.hidden&&D.addEventListener("visibilitychange",didVisibilityChange.bind(this,disconnectPerfObserversHidden)),logData("navigationTiming",getNavigationTiming()),logData("networkInformation",getNetworkInformation()),WN&&WN.storage&&"function"==typeof WN.storage.estimate&&WN.storage.estimate().then(reportStorageEstimate))}return e.prototype.start=function(e){isPerformanceSupported()&&!metrics[e]&&(metrics[e]=!0,WP.mark("mark_"+e+"_start"),visibility.s=!1)},e.prototype.end=function(e,t){void 0===t&&(t={}),isPerformanceSupported()&&metrics[e]&&(WP.mark("mark_"+e+"_end"),delete metrics[e],logData(e,roundByTwo(performanceMeasure(e)),t))},e.prototype.endPaint=function(e,t){var r=this;setTimeout((function(){r.end(e,t)}))},e.prototype.clear=function(e){delete metrics[e],WP.clearMarks&&(WP.clearMarks("mark_"+e+"_start"),WP.clearMarks("mark_"+e+"_end"))},e}();module.exports=Perfume; | ||
//# 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},v=function(n){i.hidden&&(n(),d.u=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},b=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},g=[1e3,2500],h=[2500,4e3],k=[.1,.25],y=[300,600],T={fp:g,fcp:g,lcp:h,lcpFinal:h,fid:[100,300],cls:k,clsFinal:k,tbt:y,tbt5S:y,tbt10S:y,tbtFinal:y},_=function(n,t){return T[n]?t<=T[n][0]?"good":t<=T[n][1]?"needsImprovement":"poor":null},w=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:_(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(f,{timeout:3e3}):f()},F=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),w(n,t,e)},S=function(t,e){var i=p(t);i<=n.o&&i>0&&w(e,i)},x={},E={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 t=n.pop();t&&!t.s&&t.value&&(E.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]},W=function(n){var t=n.pop();t&&S(t.duration,"fid"),O(1),S(D.value,"lcp"),C[3]&&C[3].takeRecords(),S(E.value,"cls"),S(P.value,"tbt"),setTimeout((function(){S(P.value,"tbt5S")}),5e3),setTimeout((function(){S(P.value,"tbt10S"),F("dataConsumption",I.value)}),1e4)},B=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<j.value)){var t=n.duration-50;t>0&&(P.value+=t)}}))},M=function(n){n.forEach((function(n){"first-paint"===n.name?S(n.startTime,"fp"):"first-contentful-paint"===n.name&&(j.value=n.startTime,S(j.value,"fcp"),C[4]=L("longtask",B),O(0))}))},z=function(n){var t=n.pop();t&&(D.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&&F("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;I.value[t.initiatorType]+=e,I.value.total+=e}}))},R=function(){C[2]&&(S(D.value,"lcpFinal"),O(2)),C[3]&&(C[3].takeRecords(),S(E.value,"clsFinal"),O(3)),C[4]&&(S(P.value,"tbtFinal"),O(4))},A=function(n){var t="usageDetails"in n?n.usageDetails:{};F("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.1.0",n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=!!e.elementTiming,n.o=e.maxMeasureTime||n.o,f()&&("PerformanceObserver"in t&&(C[0]=L("paint",M),C[1]=L("first-input",W),C[2]=L("largest-contentful-paint",z),n.t&&L("resource",N),C[3]=L("layout-shift",q),n.i&&L("element",H)),void 0!==i.hidden&&i.addEventListener("visibilitychange",v.bind(this,R)),F("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}}()),F("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],F(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}()})); | ||
!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,o=t.navigator,r=t.performance,u=function(){return o.deviceMemory},c=function(){return o.hardwareConcurrency},f=function(){return r&&!!r.getEntriesByType&&!!r.now&&!!r.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},v=function(n){i.hidden&&(n(),d.u=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},b=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},g=[1e3,2500],y=[2500,4e3],h=[.1,.25],k=[300,600],T={fp:g,fcp:g,lcp:y,lcpFinal:y,fid:[100,300],cls:h,clsFinal:h,tbt:k,tbt5S:k,tbt10S:k,tbtFinal:k},_=function(n,t){return T[n]?t<=T[n][0]?"good":t<=T[n][1]?"needsImprovement":"poor":null},w=function(e,i,r){var f;f=function(){d.u&&e.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:e,data:i,eventProperties:r||{},navigatorInformation:o?{deviceMemory:u()||0,hardwareConcurrency:c()||0,serviceWorkerStatus:"serviceWorker"in o?o.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(a,s)}:{},vitalsScore:_(e,i)})},"requestIdleCallback"in t?t.requestIdleCallback(f,{timeout:3e3}):f()},F=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),w(n,t,e)},S=function(t,e){var i=p(t);i<=n.o&&i>=0&&w(e,i)},x={},E={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 t=n.pop();t&&!t.s&&t.value&&(E.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]},W=function(n){var t=n.pop();t&&(S(t.l-t.startTime,"fidVitals"),S(t.duration,"fid")),O(1),S(D.value,"lcp"),C[3]&&"function"==typeof C[3].takeRecords&&C[3].takeRecords(),S(E.value,"cls"),S(P.value,"tbt"),setTimeout((function(){S(P.value,"tbt5S")}),5e3),setTimeout((function(){S(P.value,"tbt10S"),F("dataConsumption",I.value)}),1e4)},B=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<j.value)){var t=n.duration-50;t>0&&(P.value+=t)}}))},M=function(n){n.forEach((function(n){"first-paint"===n.name?S(n.startTime,"fp"):"first-contentful-paint"===n.name&&(j.value=n.startTime,S(j.value,"fcp"),C[4]=L("longtask",B),O(0))}))},z=function(n){var t=n.pop();t&&(D.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&&F("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;I.value[t.initiatorType]+=e,I.value.total+=e}}))},R=function(){C[2]&&(S(D.value,"lcpFinal"),O(2)),C[3]&&("function"==typeof C[3].takeRecords&&C[3].takeRecords(),S(E.value,"clsFinal"),O(3)),C[4]&&(S(P.value,"tbtFinal"),O(4))},V=function(n){var t="usageDetails"in n?n.usageDetails:{};F("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.m="5.2.0",n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=!!e.elementTiming,n.o=e.maxMeasureTime||n.o,f()&&("PerformanceObserver"in t&&(C[0]=L("paint",M),C[1]=L("first-input",W),C[2]=L("largest-contentful-paint",z),n.t&&L("resource",N),C[3]=L("layout-shift",q),n.i&&L("element",H)),void 0!==i.hidden&&i.addEventListener("visibilitychange",v.bind(this,R)),F("navigationTiming",function(){if(!f())return{};var n=r.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}}()),F("networkInformation",function(){if("connection"in o){var n=o.connection;return"object"!=typeof n?{}:(a=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),o&&o.storage&&"function"==typeof o.storage.estimate&&o.storage.estimate().then(V))}return e.prototype.start=function(n){f()&&!x[n]&&(x[n]=!0,r.mark("mark_"+n+"_start"),d.u=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),f()&&x[n]&&(r.mark("mark_"+n+"_end"),delete x[n],F(n,p(function(n){r.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var t=r.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],r.clearMarks&&(r.clearMarks("mark_"+n+"_start"),r.clearMarks("mark_"+n+"_end"))},e}()})); | ||
//# sourceMappingURL=perfume.umd.min.js.map |
@@ -1,2 +0,2 @@ | ||
import { IPerformanceEntry } from './types'; | ||
export declare const initFirstInputDelay: (performanceEntries: IPerformanceEntry[]) => void; | ||
import { PerformanceEventTiming } from './types'; | ||
export declare const initFirstInputDelay: (performanceEntries: PerformanceEventTiming[]) => void; |
@@ -48,2 +48,5 @@ export interface IAnalyticsTrackerOptions { | ||
} | ||
export interface PerformanceEventTiming extends PerformanceEntry { | ||
processingStart: DOMHighResTimeStamp; | ||
} | ||
export interface IPerformancePaintTiming { | ||
@@ -50,0 +53,0 @@ name: string; |
{ | ||
"name": "perfume.js", | ||
"version": "5.1.1", | ||
"version": "5.2.0", | ||
"description": "Web performance library for measuring all User-centric performance metrics.", | ||
@@ -108,3 +108,3 @@ "keywords": [ | ||
"coveralls": "3.0.7", | ||
"husky": "3.0.9", | ||
"husky": "^3.0.9", | ||
"jest": "24.9.0", | ||
@@ -111,0 +111,0 @@ "lint-staged": "9.4.3", |
146
README.md
@@ -6,3 +6,3 @@ <a href="http://www.perfumejs.com/"> | ||
# [Perfume.js v5.1.1](http://perfumejs.com) | ||
# [Perfume.js v5.2.0](http://perfumejs.com) | ||
@@ -18,3 +18,4 @@ [](https://www.npmjs.org/package/perfume.js) [](https://codeclimate.com/github/Zizzamia/perfume.js/test_coverage) <img alt="No dependencies" src="https://img.shields.io/badge/dependencies-none-27ae60.svg"> [](https://travis-ci.org/Zizzamia/perfume.js) [](https://www.npmjs.org/package/perfume.js) [](https://unpkg.com/perfume.js) [](https://unpkg.com/perfume.js) | ||
English | [简体中文](./README-zh_CN.md) | ||
English | [简体中文](./README-zh_CN.md) | [Italian](./README-it.md) | ||
## Why Perfume.js? | ||
@@ -32,21 +33,21 @@ | ||
- ⚡️ Waste-zero ms with [requestIdleCallback](https://developers.google.com/web/updates/2015/08/using-requestidlecallback) strategy built-in | ||
<br /> | ||
<br /> | ||
## The latest in metrics & Real User Measurement | ||
## The latest in metrics & Real User Measurement | ||
**Perfume** leverages the latest Performance APIs to collect **field data** that allows us to understand what real-world users are actually experiencing. | ||
* Navigation Timing | ||
* Navigator Interface | ||
* Resource Timing | ||
* Element Timing | ||
* Service Worker Status | ||
* StorageManager interface | ||
* First Paint ([FP](https://medium.com/@zizzamia/first-contentful-paint-with-a-touch-of-perfume-js-cd11dfd2e18f)) | ||
* First Contentful Paint ([FCP](https://web.dev/first-contentful-paint/)) | ||
* Largest Contentful Paint ([LCP](https://web.dev/lcp/)) | ||
* First Input Delay ([FID](https://web.dev/fid/)) | ||
* Cumulative Layout Shift ([CLS](https://web.dev/cls/)) | ||
* Total Blocking Time ([TBT](https://web.dev/tbt/)) | ||
* [Web Vitals Score](https://web.dev/vitals/) | ||
- Navigation Timing | ||
- Navigator Interface | ||
- Resource Timing | ||
- Element Timing | ||
- Service Worker Status | ||
- StorageManager interface | ||
- First Paint ([FP](https://medium.com/@zizzamia/first-contentful-paint-with-a-touch-of-perfume-js-cd11dfd2e18f)) | ||
- First Contentful Paint ([FCP](https://web.dev/first-contentful-paint/)) | ||
- Largest Contentful Paint ([LCP](https://web.dev/lcp/)) | ||
- First Input Delay ([FID](https://web.dev/fid/)) | ||
- Cumulative Layout Shift ([CLS](https://web.dev/cls/)) | ||
- Total Blocking Time ([TBT](https://web.dev/tbt/)) | ||
- [Web Vitals Score](https://web.dev/vitals/) | ||
@@ -62,3 +63,2 @@ <br /> | ||
## Installing | ||
@@ -83,5 +83,7 @@ | ||
``` | ||
<br /> | ||
## Quick start | ||
Metrics like **Navigation Timing**, **Network Information**, **FP**, **FCP**, **FID**, **LCP**, **CLS** and **TBT** are default reported with Perfume; All results will be reported to the `analyticsTracker` callback, and the code below is just one way for you to organize your tracking, feel free to tweak it suit your needs. | ||
@@ -93,4 +95,10 @@ | ||
const perfume = new Perfume({ | ||
analyticsTracker: (options) => { | ||
const { metricName, data, eventProperties, navigatorInformation, vitalsScore } = options; | ||
analyticsTracker: options => { | ||
const { | ||
metricName, | ||
data, | ||
eventProperties, | ||
navigatorInformation, | ||
vitalsScore, | ||
} = options; | ||
switch (metricName) { | ||
@@ -123,3 +131,5 @@ case 'navigationTiming': | ||
case 'lcpFinal': | ||
myAnalyticsTool.track('largestContentfulPaintFinal', { duration: data }); | ||
myAnalyticsTool.track('largestContentfulPaintFinal', { | ||
duration: data, | ||
}); | ||
break; | ||
@@ -145,3 +155,3 @@ case 'cls': | ||
} | ||
} | ||
}, | ||
}); | ||
@@ -151,2 +161,3 @@ ``` | ||
In a world with widely varying device capabilities, a one-size-fits-all event doesn’t always work. Perfume adds **data enrichment** to all events so we can better understand the real world experiences: | ||
- **deviceMemory**: the user's device memory (RAM). | ||
@@ -157,2 +168,3 @@ - **hardwareConcurrency**: the number of logical CPU processor cores on the user's device. | ||
Based on the Navigator APIs the library can help us differentiate between a low-end and a high-end device/experience: | ||
- **isLowEndDevice**: combination of the score of RAM and CPU. | ||
@@ -162,8 +174,11 @@ - **isLowEndExperience**: combination of the score of RAM, CPU, NetworkStatus and SaveData. | ||
## Performance audits | ||
Coo coo coo [cool](https://www.youtube.com/watch?v=zDcbpFimUc8), let's learn something new. | ||
### Navigation Timing | ||
Navigation Timing collects performance metrics for the life and timings of a network request. | ||
Perfume helps expose some of the key metrics you might need. | ||
<ul> | ||
@@ -220,2 +235,3 @@ <li><b>DNS lookup</b>: When a user requests a URL, the Domain Name System (DNS) is queried to translate a domain to an IP address.</li> | ||
### Cumulative Layout Shift (CLS) | ||
**CLS** is an important, user-centric metric for measuring visual stability because it helps quantify how often users experience unexpected layout shifts—a low CLS helps ensure that the page is delightful. | ||
@@ -231,2 +247,3 @@ | ||
### Total Blocking Time (TBT) | ||
**TBT** is an important, user-centric metric for measuring load responsiveness because it helps quantify the severity of how non-interactive a page is prior to it becoming reliably interactive—a low TBT helps ensure that the page is usable. | ||
@@ -237,9 +254,10 @@ | ||
```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 | ||
// Perfume.js: tbt 347.07 ms | ||
// Perfume.js: tbt5S 427.14 ms | ||
// Perfume.js: tbt10S 427.14 ms | ||
// Perfume.js: tbtFinal 526.08 ms | ||
``` | ||
### Resource Timing | ||
Resource Timing collects performance metrics for document-dependent resources. Stuff like style sheets, scripts, images, et cetera. | ||
@@ -300,3 +318,7 @@ Perfume helps expose all PerformanceResourceTiming entries and groups data data consumption by Kb used. | ||
<h1 elementtiming="elPageTitle" class="title">Perfume.js</h1> | ||
<img elementtiming="elHeroLogo" alt="Perfume.js logo" src="https://zizzamia.github.io/perfume/assets/perfume-logo-v5-0-0.png"> | ||
<img | ||
elementtiming="elHeroLogo" | ||
alt="Perfume.js logo" | ||
src="https://zizzamia.github.io/perfume/assets/perfume-logo-v5-0-0.png" | ||
/> | ||
``` | ||
@@ -317,17 +339,18 @@ | ||
## Web Vitals Score | ||
Perfume will expose for all major metrics the vitals score, those can be used to improve your [SEO and Google page rank](https://webmasters.googleblog.com/2020/05/evaluating-page-experience.html). | ||
| Web Vitals | Good | Needs Improvement | Poor | | ||
| ----------------------------------------- | -------------:| -----------------:| ---------:| | ||
| Fist Paint (fp) | 0-1000 | 1001-2500 | Over 2500 | | ||
| First Contentful Paint (fcp) | 0-1000 | 1001-2500 | Over 2500 | | ||
| Largest Contentful Paint (lcp) | 0-2500 | 2501-4000 | Over 4000 | | ||
| Largest Contentful Paint Final (lcpFinal) | 0-2500 | 2501-4000 | Over 4000 | | ||
| First Input Delay (fid) | 0-100 | 101-300 | Over 300 | | ||
| Cumulative Layout Shift (cls) | 0-0.1 | 0.11-0.25 | Over 0.25 | | ||
| Cumulative Layout Shift Final (clsFinal) | 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 | | ||
| Web Vitals | Good | Needs Improvement | Poor | | ||
| ----------------------------------------- | -----: | ----------------: | --------: | | ||
| Fist Paint (fp) | 0-1000 | 1001-2500 | Over 2500 | | ||
| First Contentful Paint (fcp) | 0-1000 | 1001-2500 | Over 2500 | | ||
| Largest Contentful Paint (lcp) | 0-2500 | 2501-4000 | Over 4000 | | ||
| Largest Contentful Paint Final (lcpFinal) | 0-2500 | 2501-4000 | Over 4000 | | ||
| First Input Delay (fid) | 0-100 | 101-300 | Over 300 | | ||
| Cumulative Layout Shift (cls) | 0-0.1 | 0.11-0.25 | Over 0.25 | | ||
| Cumulative Layout Shift Final (clsFinal) | 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 | | ||
@@ -348,2 +371,3 @@ ## Perfume custom options | ||
## Use Google Analytics | ||
A quick way to see your page speed results on your web app is by using Google Analytics. Those GA events will show on Behavior > Site Speed > User Timings. For testing you might want to see them coming live on Realtime > Events. | ||
@@ -378,24 +402,25 @@ | ||
* `npm run test`: Run test suite | ||
* `npm run build`: Generate bundles and typings | ||
* `npm run lint`: Lints code | ||
<br /> | ||
- `npm run test`: Run test suite | ||
- `npm run build`: Generate bundles and typings | ||
- `npm run lint`: Lints code | ||
<br /> | ||
## Plugins | ||
* [Perfume.js plugin for GatsbyJS](https://github.com/NoriSte/gatsby-plugin-perfume.js) | ||
* [Perfume.js plugin for Analytics](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-perfumejs) | ||
<br /> | ||
- [Perfume.js plugin for GatsbyJS](https://github.com/NoriSte/gatsby-plugin-perfume.js) | ||
- [Perfume.js plugin for Analytics](https://github.com/DavidWells/analytics/tree/master/packages/analytics-plugin-perfumejs) | ||
<br /> | ||
## Perfume is used by | ||
* [Conio](https://business.conio.com/) | ||
* [Coinbase](https://www.coinbase.com) | ||
* [Coinbase Pro](https://pro.coinbase.com) | ||
* [Coinbase Custody](https://custody.coinbase.com) | ||
* [Financial-Times](https://github.com/Financial-Times/n-tracking) | ||
* [Hearst](https://www.cosmopolitan.com/) | ||
* [Plan](https://getplan.co) | ||
* Add your company name :) | ||
<br /> | ||
- [Conio](https://business.conio.com/) | ||
- [Coinbase](https://www.coinbase.com) | ||
- [Coinbase Pro](https://pro.coinbase.com) | ||
- [Coinbase Custody](https://custody.coinbase.com) | ||
- [Financial-Times](https://github.com/Financial-Times/n-tracking) | ||
- [Hearst](https://www.cosmopolitan.com/) | ||
- [Plan](https://getplan.co) | ||
- Add your company name :) | ||
<br /> | ||
## Credits and Specs | ||
@@ -406,8 +431,7 @@ | ||
* [Leraging the Performance Metrics that Most Affect User Experience](https://developers.google.com/web/updates/2017/06/user-centric-performance-metrics) for documenting this new User-centric performance metrics;ev | ||
* [Performance Timeline Level 2](https://w3c.github.io/performance-timeline/) the definition of _PerformanceObserver_ in that specification; | ||
* [The Contributors](https://github.com/Zizzamia/perfume.js/graphs/contributors) for their much appreciated Pull Requests and bug reports; | ||
* **you** for the star you'll give this project 😉 and for supporting me by giving my project a try 😄 | ||
- [Leraging the Performance Metrics that Most Affect User Experience](https://developers.google.com/web/updates/2017/06/user-centric-performance-metrics) for documenting this new User-centric performance metrics;ev | ||
- [Performance Timeline Level 2](https://w3c.github.io/performance-timeline/) the definition of _PerformanceObserver_ in that specification; | ||
- [The Contributors](https://github.com/Zizzamia/perfume.js/graphs/contributors) for their much appreciated Pull Requests and bug reports; | ||
- **you** for the star you'll give this project 😉 and for supporting me by giving my project a try 😄 | ||
### Contributors | ||
@@ -414,0 +438,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
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
273512
1.79%1546
1.38%450
5.63%