perfume.js
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -1,12 +0,1 @@ | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var Perfume = /** @class */ (function () { | ||
@@ -46,3 +35,3 @@ function Perfume(options) { | ||
this.isHidden = false; | ||
this.largestContentfulPaintDuration = 0; | ||
this.lcpDuration = 0; | ||
this.logMetricWarn = 'Missing metric name'; | ||
@@ -143,13 +132,9 @@ this.logPrefixRecording = 'Recording already'; | ||
}; | ||
Perfume.prototype.digestFirstInputDelayEntries = function (entries) { | ||
Perfume.prototype.digestFirstInputDelayEntries = function (performanceEntries) { | ||
this.performanceObserverCb({ | ||
entries: entries, | ||
metricLog: 'First Input Delay', | ||
performanceEntries: performanceEntries, | ||
metricName: 'firstInputDelay', | ||
valueLog: 'duration', | ||
}); | ||
if (this.config.largestContentfulPaint && | ||
this.largestContentfulPaintDuration) { | ||
this.logMetric(this.largestContentfulPaintDuration, 'Largest Contentful Paint', 'largestContentfulPaint'); | ||
} | ||
this.disconnectlargestContentfulPaint(); | ||
this.disconnectDataConsumption(); | ||
@@ -162,7 +147,14 @@ }; | ||
clearTimeout(this.dataConsumptionTimeout); | ||
this.dataConsumptionTimeout = undefined; | ||
this.logData('dataConsumption', this.dataConsumption); | ||
}; | ||
Perfume.prototype.disconnectlargestContentfulPaint = function () { | ||
if (this.perfObservers.lcp && this.lcpDuration) { | ||
this.logMetric(this.lcpDuration, 'largestContentfulPaint'); | ||
this.perfObservers.lcp.disconnect(); | ||
} | ||
}; | ||
Perfume.prototype.initFirstInputDelay = function () { | ||
try { | ||
this.perfObservers.firstInputDelay = this.performanceObserver('first-input', this.digestFirstInputDelayEntries.bind(this)); | ||
this.perfObservers.fid = this.performanceObserver('first-input', this.digestFirstInputDelayEntries.bind(this)); | ||
} | ||
@@ -180,7 +172,6 @@ catch (e) { | ||
try { | ||
this.perfObservers.firstContentfulPaint = this.performanceObserver('paint', function (entries) { | ||
this.perfObservers.fcp = this.performanceObserver('paint', function (performanceEntries) { | ||
_this.performanceObserverCb({ | ||
entries: entries, | ||
performanceEntries: performanceEntries, | ||
entryName: 'first-paint', | ||
metricLog: 'First Paint', | ||
metricName: 'firstPaint', | ||
@@ -190,5 +181,4 @@ valueLog: 'startTime', | ||
_this.performanceObserverCb({ | ||
entries: entries, | ||
performanceEntries: performanceEntries, | ||
entryName: 'first-contentful-paint', | ||
metricLog: 'First Contentful Paint', | ||
metricName: 'firstContentfulPaint', | ||
@@ -206,6 +196,7 @@ valueLog: 'startTime', | ||
try { | ||
this.perfObservers.largestContentfulPaint = this.performanceObserver('largest-contentful-paint', function (entries) { | ||
var lastPerformanceEntry = entries[entries.length - 1]; | ||
_this.largestContentfulPaintDuration = | ||
lastPerformanceEntry.renderTime || lastPerformanceEntry.loadTime; | ||
this.perfObservers.lcp = this.performanceObserver('largest-contentful-paint', function (performanceEntries) { | ||
var lastEntry = performanceEntries.pop(); | ||
if (lastEntry) { | ||
_this.lcpDuration = lastEntry.renderTime || lastEntry.loadTime; | ||
} | ||
}); | ||
@@ -233,5 +224,5 @@ } | ||
try { | ||
this.performanceObserver('resource', function (entries) { | ||
this.performanceObserver('resource', function (performanceEntries) { | ||
_this.performanceObserverResourceCb({ | ||
entries: entries, | ||
performanceEntries: performanceEntries, | ||
}); | ||
@@ -272,4 +263,4 @@ }); | ||
Perfume.prototype.getDurationByMetric = function (metricName) { | ||
var entries = this.wp.getEntriesByName(metricName); | ||
var entry = entries[entries.length - 1]; | ||
var performanceEntries = this.wp.getEntriesByName(metricName); | ||
var entry = performanceEntries[performanceEntries.length - 1]; | ||
if (entry && entry.entryType === 'measure') { | ||
@@ -316,3 +307,3 @@ return entry.duration; | ||
// HTTP header size | ||
headerSize: n.transferSize - n.encodedBodySize, | ||
headerSize: n.transferSize - n.encodedBodySize || 0, | ||
// Measuring DNS lookup time | ||
@@ -341,3 +332,3 @@ dnsLookupTime: n.domainLookupEnd - n.domainLookupStart, | ||
*/ | ||
Perfume.prototype.logMetric = function (duration, logText, metricName, suffix) { | ||
Perfume.prototype.logMetric = function (duration, metricName, suffix) { | ||
var _this = this; | ||
@@ -347,3 +338,4 @@ if (suffix === void 0) { suffix = 'ms'; } | ||
// Stop Analytics and Logging for false negative metrics | ||
if (duration2Decimal > this.config.maxMeasureTime) { | ||
if (duration2Decimal > this.config.maxMeasureTime || | ||
duration2Decimal <= 0) { | ||
return; | ||
@@ -353,3 +345,3 @@ } | ||
// Logs the metric in the internal console.log | ||
_this.log({ metricName: logText, duration: duration2Decimal, suffix: suffix }); | ||
_this.log({ metricName: metricName, duration: duration2Decimal, suffix: suffix }); | ||
// Sends the metric to an external tracking service | ||
@@ -363,3 +355,2 @@ _this.sendTiming({ metricName: metricName, duration: duration2Decimal }); | ||
Perfume.prototype.log = function (options) { | ||
var _a = __assign({ suffix: 'ms' }, options), metricName = _a.metricName, data = _a.data, duration = _a.duration, suffix = _a.suffix; | ||
// Don't log when page is hidden or has disabled logging | ||
@@ -369,15 +360,15 @@ if (this.isHidden || !this.config.logging) { | ||
} | ||
if (!metricName) { | ||
if (!options.metricName) { | ||
this.logWarn(this.logMetricWarn); | ||
return; | ||
} | ||
var style = 'color: #ff6d00;font-size:11px;'; | ||
var text = "%c " + this.config.logPrefix + " " + metricName + " "; | ||
if (duration) { | ||
var durationMs = duration.toFixed(2); | ||
text += durationMs + " " + suffix; | ||
var style = 'color:#ff6d00;font-size:11px;'; | ||
var text = "%c " + this.config.logPrefix + " " + options.metricName + " "; | ||
if (options.duration) { | ||
var durationMs = options.duration.toFixed(2); | ||
text += durationMs + " " + (options.suffix || 'ms'); | ||
this.c.log(text, style); | ||
} | ||
else if (data) { | ||
this.c.log(text, style, data); | ||
else if (options.data) { | ||
this.c.log(text, style, options.data); | ||
} | ||
@@ -422,4 +413,4 @@ }; | ||
this.perfObserver = new PerformanceObserver(function (entryList) { | ||
var entries = entryList.getEntries(); | ||
cb(entries); | ||
var performanceEntries = entryList.getEntries(); | ||
cb(performanceEntries); | ||
}); | ||
@@ -435,16 +426,15 @@ // Retrieve buffered events and subscribe to newer events for Paint Timing | ||
var _this = this; | ||
options.entries.forEach(function (performanceEntry) { | ||
options.performanceEntries.forEach(function (performanceEntry) { | ||
if (_this.config[options.metricName] && | ||
(!options.entryName || | ||
(options.entryName && performanceEntry.name === options.entryName))) { | ||
_this.logMetric(performanceEntry[options.valueLog], options.metricLog, options.metricName); | ||
_this.logMetric(performanceEntry[options.valueLog], options.metricName); | ||
} | ||
if (_this.perfObservers.firstContentfulPaint && | ||
if (_this.perfObservers.fcp && | ||
performanceEntry.name === 'first-contentful-paint') { | ||
_this.perfObservers.firstContentfulPaint.disconnect(); | ||
_this.perfObservers.fcp.disconnect(); | ||
} | ||
}); | ||
if (this.perfObservers.firstInputDelay && | ||
options.metricName === 'firstInputDelay') { | ||
this.perfObservers.firstInputDelay.disconnect(); | ||
if (this.perfObservers.fid && options.metricName === 'firstInputDelay') { | ||
this.perfObservers.fid.disconnect(); | ||
} | ||
@@ -454,3 +444,3 @@ }; | ||
var _this = this; | ||
options.entries.forEach(function (performanceEntry) { | ||
options.performanceEntries.forEach(function (performanceEntry) { | ||
if (_this.config.resourceTiming) { | ||
@@ -457,0 +447,0 @@ _this.logData('resourceTiming', performanceEntry); |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -48,3 +37,3 @@ var Perfume = /** @class */ (function () { | ||
this.isHidden = false; | ||
this.largestContentfulPaintDuration = 0; | ||
this.lcpDuration = 0; | ||
this.logMetricWarn = 'Missing metric name'; | ||
@@ -145,13 +134,9 @@ this.logPrefixRecording = 'Recording already'; | ||
}; | ||
Perfume.prototype.digestFirstInputDelayEntries = function (entries) { | ||
Perfume.prototype.digestFirstInputDelayEntries = function (performanceEntries) { | ||
this.performanceObserverCb({ | ||
entries: entries, | ||
metricLog: 'First Input Delay', | ||
performanceEntries: performanceEntries, | ||
metricName: 'firstInputDelay', | ||
valueLog: 'duration', | ||
}); | ||
if (this.config.largestContentfulPaint && | ||
this.largestContentfulPaintDuration) { | ||
this.logMetric(this.largestContentfulPaintDuration, 'Largest Contentful Paint', 'largestContentfulPaint'); | ||
} | ||
this.disconnectlargestContentfulPaint(); | ||
this.disconnectDataConsumption(); | ||
@@ -164,7 +149,14 @@ }; | ||
clearTimeout(this.dataConsumptionTimeout); | ||
this.dataConsumptionTimeout = undefined; | ||
this.logData('dataConsumption', this.dataConsumption); | ||
}; | ||
Perfume.prototype.disconnectlargestContentfulPaint = function () { | ||
if (this.perfObservers.lcp && this.lcpDuration) { | ||
this.logMetric(this.lcpDuration, 'largestContentfulPaint'); | ||
this.perfObservers.lcp.disconnect(); | ||
} | ||
}; | ||
Perfume.prototype.initFirstInputDelay = function () { | ||
try { | ||
this.perfObservers.firstInputDelay = this.performanceObserver('first-input', this.digestFirstInputDelayEntries.bind(this)); | ||
this.perfObservers.fid = this.performanceObserver('first-input', this.digestFirstInputDelayEntries.bind(this)); | ||
} | ||
@@ -182,7 +174,6 @@ catch (e) { | ||
try { | ||
this.perfObservers.firstContentfulPaint = this.performanceObserver('paint', function (entries) { | ||
this.perfObservers.fcp = this.performanceObserver('paint', function (performanceEntries) { | ||
_this.performanceObserverCb({ | ||
entries: entries, | ||
performanceEntries: performanceEntries, | ||
entryName: 'first-paint', | ||
metricLog: 'First Paint', | ||
metricName: 'firstPaint', | ||
@@ -192,5 +183,4 @@ valueLog: 'startTime', | ||
_this.performanceObserverCb({ | ||
entries: entries, | ||
performanceEntries: performanceEntries, | ||
entryName: 'first-contentful-paint', | ||
metricLog: 'First Contentful Paint', | ||
metricName: 'firstContentfulPaint', | ||
@@ -208,6 +198,7 @@ valueLog: 'startTime', | ||
try { | ||
this.perfObservers.largestContentfulPaint = this.performanceObserver('largest-contentful-paint', function (entries) { | ||
var lastPerformanceEntry = entries[entries.length - 1]; | ||
_this.largestContentfulPaintDuration = | ||
lastPerformanceEntry.renderTime || lastPerformanceEntry.loadTime; | ||
this.perfObservers.lcp = this.performanceObserver('largest-contentful-paint', function (performanceEntries) { | ||
var lastEntry = performanceEntries.pop(); | ||
if (lastEntry) { | ||
_this.lcpDuration = lastEntry.renderTime || lastEntry.loadTime; | ||
} | ||
}); | ||
@@ -235,5 +226,5 @@ } | ||
try { | ||
this.performanceObserver('resource', function (entries) { | ||
this.performanceObserver('resource', function (performanceEntries) { | ||
_this.performanceObserverResourceCb({ | ||
entries: entries, | ||
performanceEntries: performanceEntries, | ||
}); | ||
@@ -274,4 +265,4 @@ }); | ||
Perfume.prototype.getDurationByMetric = function (metricName) { | ||
var entries = this.wp.getEntriesByName(metricName); | ||
var entry = entries[entries.length - 1]; | ||
var performanceEntries = this.wp.getEntriesByName(metricName); | ||
var entry = performanceEntries[performanceEntries.length - 1]; | ||
if (entry && entry.entryType === 'measure') { | ||
@@ -318,3 +309,3 @@ return entry.duration; | ||
// HTTP header size | ||
headerSize: n.transferSize - n.encodedBodySize, | ||
headerSize: n.transferSize - n.encodedBodySize || 0, | ||
// Measuring DNS lookup time | ||
@@ -343,3 +334,3 @@ dnsLookupTime: n.domainLookupEnd - n.domainLookupStart, | ||
*/ | ||
Perfume.prototype.logMetric = function (duration, logText, metricName, suffix) { | ||
Perfume.prototype.logMetric = function (duration, metricName, suffix) { | ||
var _this = this; | ||
@@ -349,3 +340,4 @@ if (suffix === void 0) { suffix = 'ms'; } | ||
// Stop Analytics and Logging for false negative metrics | ||
if (duration2Decimal > this.config.maxMeasureTime) { | ||
if (duration2Decimal > this.config.maxMeasureTime || | ||
duration2Decimal <= 0) { | ||
return; | ||
@@ -355,3 +347,3 @@ } | ||
// Logs the metric in the internal console.log | ||
_this.log({ metricName: logText, duration: duration2Decimal, suffix: suffix }); | ||
_this.log({ metricName: metricName, duration: duration2Decimal, suffix: suffix }); | ||
// Sends the metric to an external tracking service | ||
@@ -365,3 +357,2 @@ _this.sendTiming({ metricName: metricName, duration: duration2Decimal }); | ||
Perfume.prototype.log = function (options) { | ||
var _a = __assign({ suffix: 'ms' }, options), metricName = _a.metricName, data = _a.data, duration = _a.duration, suffix = _a.suffix; | ||
// Don't log when page is hidden or has disabled logging | ||
@@ -371,15 +362,15 @@ if (this.isHidden || !this.config.logging) { | ||
} | ||
if (!metricName) { | ||
if (!options.metricName) { | ||
this.logWarn(this.logMetricWarn); | ||
return; | ||
} | ||
var style = 'color: #ff6d00;font-size:11px;'; | ||
var text = "%c " + this.config.logPrefix + " " + metricName + " "; | ||
if (duration) { | ||
var durationMs = duration.toFixed(2); | ||
text += durationMs + " " + suffix; | ||
var style = 'color:#ff6d00;font-size:11px;'; | ||
var text = "%c " + this.config.logPrefix + " " + options.metricName + " "; | ||
if (options.duration) { | ||
var durationMs = options.duration.toFixed(2); | ||
text += durationMs + " " + (options.suffix || 'ms'); | ||
this.c.log(text, style); | ||
} | ||
else if (data) { | ||
this.c.log(text, style, data); | ||
else if (options.data) { | ||
this.c.log(text, style, options.data); | ||
} | ||
@@ -424,4 +415,4 @@ }; | ||
this.perfObserver = new PerformanceObserver(function (entryList) { | ||
var entries = entryList.getEntries(); | ||
cb(entries); | ||
var performanceEntries = entryList.getEntries(); | ||
cb(performanceEntries); | ||
}); | ||
@@ -437,16 +428,15 @@ // Retrieve buffered events and subscribe to newer events for Paint Timing | ||
var _this = this; | ||
options.entries.forEach(function (performanceEntry) { | ||
options.performanceEntries.forEach(function (performanceEntry) { | ||
if (_this.config[options.metricName] && | ||
(!options.entryName || | ||
(options.entryName && performanceEntry.name === options.entryName))) { | ||
_this.logMetric(performanceEntry[options.valueLog], options.metricLog, options.metricName); | ||
_this.logMetric(performanceEntry[options.valueLog], options.metricName); | ||
} | ||
if (_this.perfObservers.firstContentfulPaint && | ||
if (_this.perfObservers.fcp && | ||
performanceEntry.name === 'first-contentful-paint') { | ||
_this.perfObservers.firstContentfulPaint.disconnect(); | ||
_this.perfObservers.fcp.disconnect(); | ||
} | ||
}); | ||
if (this.perfObservers.firstInputDelay && | ||
options.metricName === 'firstInputDelay') { | ||
this.perfObservers.firstInputDelay.disconnect(); | ||
if (this.perfObservers.fid && options.metricName === 'firstInputDelay') { | ||
this.perfObservers.fid.disconnect(); | ||
} | ||
@@ -456,3 +446,3 @@ }; | ||
var _this = this; | ||
options.entries.forEach(function (performanceEntry) { | ||
options.performanceEntries.forEach(function (performanceEntry) { | ||
if (_this.config.resourceTiming) { | ||
@@ -459,0 +449,0 @@ _this.logData('resourceTiming', performanceEntry); |
@@ -1,2 +0,2 @@ | ||
var t=function(){return(t=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var e in i=arguments[n])Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}).apply(this,arguments)},i=function(){function i(t){var i=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,warning:!1},this.c=window.console,this.d=document,this.dataConsumption={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.t=!1,this.i=0,this.s="Missing metric name",this.h="Recording already",this.o={},this.u={},this.m={},this.w=window,this.l=window.performance,this.v=function(){i.d.hidden&&(i.t=i.d.hidden)},this.config=Object.assign({},this.config,t),this.g()&&(this.p()&&this.T(),this.P(),this.config.navigationTiming&&this.N("navigationTiming",this.C()))}return i.prototype.start=function(t){this.F(t)&&this.g()&&(this.o[t]?this.L(this.h+" started."):(this.o[t]={end:0,start:this.l.now()},this.k(t,"start"),this.t=!1))},i.prototype.end=function(t){var i=this;if(this.F(t)&&this.g()){var n=this.o[t];if(n){n.end=this.l.now(),this.k(t,"end");var s=this.O(t),e=parseFloat(s.toFixed(2));return delete this.o[t],this.j((function(){i.log({metricName:t,duration:e}),i.sendTiming({metricName:t,duration:e})})),e}this.L(this.h+" stopped.")}},i.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var s=i.end(t);n(s)}))}))},i.prototype.F=function(t){return!!t||(this.L(this.s),!1)},i.prototype.D=function(t){this.I({entries:t,_:"First Input Delay",metricName:"firstInputDelay",q:"duration"}),this.config.largestContentfulPaint&&this.i&&this.M(this.i,"Largest Contentful Paint","largestContentfulPaint"),this.B()},i.prototype.B=function(){this.R&&(clearTimeout(this.R),this.N("dataConsumption",this.dataConsumption))},i.prototype.S=function(){try{this.m.firstInputDelay=this.A("first-input",this.D.bind(this))}catch(t){this.L("FID:failed")}},i.prototype.G=function(){var t=this;try{this.m.firstContentfulPaint=this.A("paint",(function(i){t.I({entries:i,H:"first-paint",_:"First Paint",metricName:"firstPaint",q:"startTime"}),t.I({entries:i,H:"first-contentful-paint",_:"First Contentful Paint",metricName:"firstContentfulPaint",q:"startTime"})}))}catch(t){this.L("FP:failed")}},i.prototype.J=function(){var t=this;try{this.m.largestContentfulPaint=this.A("largest-contentful-paint",(function(i){var n=i[i.length-1];t.i=n.K||n.U}))}catch(t){this.L("LCP:failed")}},i.prototype.T=function(){(this.config.firstPaint||this.config.firstContentfulPaint)&&this.G(),this.S(),this.J(),(this.config.resourceTiming||this.config.dataConsumption)&&this.V()},i.prototype.V=function(){var t=this;try{this.A("resource",(function(i){t.W({entries:i})}))}catch(t){this.L("DataConsumption:failed")}this.R=setTimeout((function(){t.B()}),15e3)},i.prototype.g=function(){return this.l&&!!this.l.getEntriesByType&&!!this.l.now&&!!this.l.mark},i.prototype.p=function(){return this.w.chrome&&"PerformanceObserver"in this.w},i.prototype.X=function(t){var i=this.l.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},i.prototype.C=function(){if(!this.config.navigationTiming)return{};if(!this.g()||Object.keys(this.u).length)return this.u;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.u;var i=t.responseStart,n=t.responseEnd;return this.u={fetchTime:n-t.fetchStart,workerTime:t.Y>0?n-t.Y:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.Z-t.$,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart},this.u},i.prototype.N=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))})),this.j((function(){n.log({metricName:t,data:i,suffix:""}),n.sendTiming({metricName:t,data:i})}))},i.prototype.M=function(t,i,n,s){var e=this;void 0===s&&(s="ms");var r=parseFloat(t.toFixed(2));r>this.config.maxMeasureTime||this.j((function(){e.log({metricName:i,duration:r,suffix:s}),e.sendTiming({metricName:n,duration:r})}))},i.prototype.log=function(i){var n=t({suffix:"ms"},i),s=n.metricName,e=n.data,r=n.duration,h=n.suffix;if(!this.t&&this.config.logging)if(s){var a="color: #ff6d00;font-size:11px;",o="%c "+this.config.logPrefix+" "+s+" ";if(r)o+=r.toFixed(2)+" "+h,this.c.log(o,a);else e&&this.c.log(o,a,e)}else this.L(this.s)},i.prototype.L=function(t){this.config.warning&&this.config.logging&&this.c.warn(this.config.logPrefix,t)},i.prototype.P=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.v)},i.prototype.k=function(t,i){var n="mark_"+t+"_"+i;this.l.mark(n)},i.prototype.O=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.l.measure(t,i,n),this.X(t)},i.prototype.A=function(t,i){return this.tt=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.tt.observe({type:t,buffered:!0}),this.tt},i.prototype.I=function(t){var i=this;t.entries.forEach((function(n){i.config[t.metricName]&&(!t.H||t.H&&n.name===t.H)&&i.M(n[t.q],t._,t.metricName),i.m.firstContentfulPaint&&"first-contentful-paint"===n.name&&i.m.firstContentfulPaint.disconnect()})),this.m.firstInputDelay&&"firstInputDelay"===t.metricName&&this.m.firstInputDelay.disconnect()},i.prototype.W=function(t){var i=this;t.entries.forEach((function(t){i.config.resourceTiming&&i.N("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType&&(i.dataConsumption[t.initiatorType]+=t.decodedBodySize/1e3)}))},i.prototype.j=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},i.prototype.sendTiming=function(t){var i=t.metricName,n=t.data,s=t.duration;this.t||this.config.analyticsTracker({metricName:i,data:n,duration:s})},i}();export default i; | ||
var t=function(){function t(t){var i=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,warning:!1},this.c=window.console,this.d=document,this.dataConsumption={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.t=!1,this.i=0,this.s="Missing metric name",this.h="Recording already",this.o={},this.u={},this.m={},this.w=window,this.l=window.performance,this.v=function(){i.d.hidden&&(i.t=i.d.hidden)},this.config=Object.assign({},this.config,t),this.p()&&(this.g()&&this.T(),this.P(),this.config.navigationTiming&&this.N("navigationTiming",this.C()))}return t.prototype.start=function(t){this.k(t)&&this.p()&&(this.o[t]?this.F(this.h+" started."):(this.o[t]={end:0,start:this.l.now()},this._(t,"start"),this.t=!1))},t.prototype.end=function(t){var i=this;if(this.k(t)&&this.p()){var s=this.o[t];if(s){s.end=this.l.now(),this._(t,"end");var n=this.D(t),e=parseFloat(n.toFixed(2));return delete this.o[t],this.I((function(){i.log({metricName:t,duration:e}),i.L({metricName:t,duration:e})})),e}this.F(this.h+" stopped.")}},t.prototype.endPaint=function(t){var i=this;return new Promise((function(s){setTimeout((function(){var n=i.end(t);s(n)}))}))},t.prototype.k=function(t){return!!t||(this.F(this.s),!1)},t.prototype.O=function(t){this.j({q:t,metricName:"firstInputDelay",M:"duration"}),this.B(),this.R()},t.prototype.R=function(){this.S&&(clearTimeout(this.S),this.S=void 0,this.N("dataConsumption",this.dataConsumption))},t.prototype.B=function(){this.m.A&&this.i&&(this.G(this.i,"largestContentfulPaint"),this.m.A.disconnect())},t.prototype.H=function(){try{this.m.J=this.K("first-input",this.O.bind(this))}catch(t){this.F("FID:failed")}},t.prototype.U=function(){var t=this;try{this.m.V=this.K("paint",(function(i){t.j({q:i,W:"first-paint",metricName:"firstPaint",M:"startTime"}),t.j({q:i,W:"first-contentful-paint",metricName:"firstContentfulPaint",M:"startTime"})}))}catch(t){this.F("FP:failed")}},t.prototype.X=function(){var t=this;try{this.m.A=this.K("largest-contentful-paint",(function(i){var s=i.pop();s&&(t.i=s.renderTime||s.loadTime)}))}catch(t){this.F("LCP:failed")}},t.prototype.T=function(){(this.config.firstPaint||this.config.firstContentfulPaint)&&this.U(),this.H(),this.X(),(this.config.resourceTiming||this.config.dataConsumption)&&this.Y()},t.prototype.Y=function(){var t=this;try{this.K("resource",(function(i){t.Z({q:i})}))}catch(t){this.F("DataConsumption:failed")}this.S=setTimeout((function(){t.R()}),15e3)},t.prototype.p=function(){return this.l&&!!this.l.getEntriesByType&&!!this.l.now&&!!this.l.mark},t.prototype.g=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.$=function(t){var i=this.l.getEntriesByName(t),s=i[i.length-1];return s&&"measure"===s.entryType?s.duration:-1},t.prototype.C=function(){if(!this.config.navigationTiming)return{};if(!this.p()||Object.keys(this.u).length)return this.u;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.u;var i=t.responseStart,s=t.responseEnd;return this.u={fetchTime:s-t.fetchStart,workerTime:t.tt>0?s-t.tt:0,totalTime:s-t.requestStart,downloadTime:s-i,timeToFirstByte:i-t.requestStart,headerSize:t.it-t.st||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart},this.u},t.prototype.N=function(t,i){var s=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))})),this.I((function(){s.log({metricName:t,data:i,suffix:""}),s.L({metricName:t,data:i})}))},t.prototype.G=function(t,i,s){var n=this;void 0===s&&(s="ms");var e=parseFloat(t.toFixed(2));e>this.config.maxMeasureTime||e<=0||this.I((function(){n.log({metricName:i,duration:e,suffix:s}),n.L({metricName:i,duration:e})}))},t.prototype.log=function(t){if(!this.t&&this.config.logging)if(t.metricName){var i="color:#ff6d00;font-size:11px;",s="%c "+this.config.logPrefix+" "+t.metricName+" ";if(t.duration)s+=t.duration.toFixed(2)+" "+(t.suffix||"ms"),this.c.log(s,i);else t.data&&this.c.log(s,i,t.data)}else this.F(this.s)},t.prototype.F=function(t){this.config.warning&&this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.P=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.v)},t.prototype._=function(t,i){var s="mark_"+t+"_"+i;this.l.mark(s)},t.prototype.D=function(t){var i="mark_"+t+"_start",s="mark_"+t+"_end";return this.l.measure(t,i,s),this.$(t)},t.prototype.K=function(t,i){return this.nt=new PerformanceObserver((function(t){var s=t.getEntries();i(s)})),this.nt.observe({type:t,buffered:!0}),this.nt},t.prototype.j=function(t){var i=this;t.q.forEach((function(s){i.config[t.metricName]&&(!t.W||t.W&&s.name===t.W)&&i.G(s[t.M],t.metricName),i.m.V&&"first-contentful-paint"===s.name&&i.m.V.disconnect()})),this.m.J&&"firstInputDelay"===t.metricName&&this.m.J.disconnect()},t.prototype.Z=function(t){var i=this;t.q.forEach((function(t){i.config.resourceTiming&&i.N("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType&&(i.dataConsumption[t.initiatorType]+=t.decodedBodySize/1e3)}))},t.prototype.I=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.L=function(t){var i=t.metricName,s=t.data,n=t.duration;this.t||this.config.analyticsTracker({metricName:i,data:s,duration:n})},t}();export default t; | ||
//# sourceMappingURL=perfume.esm.min.js.map |
@@ -1,2 +0,2 @@ | ||
var Perfume=function(){"use strict";var t=function(){return(t=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var e in i=arguments[n])Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}).apply(this,arguments)};return function(){function i(t){var i=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,warning:!1},this.c=window.console,this.d=document,this.dataConsumption={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.t=!1,this.i=0,this.s="Missing metric name",this.h="Recording already",this.o={},this.u={},this.m={},this.w=window,this.l=window.performance,this.v=function(){i.d.hidden&&(i.t=i.d.hidden)},this.config=Object.assign({},this.config,t),this.g()&&(this.p()&&this.P(),this.T(),this.config.navigationTiming&&this.N("navigationTiming",this.C()))}return i.prototype.start=function(t){this.F(t)&&this.g()&&(this.o[t]?this.L(this.h+" started."):(this.o[t]={end:0,start:this.l.now()},this.k(t,"start"),this.t=!1))},i.prototype.end=function(t){var i=this;if(this.F(t)&&this.g()){var n=this.o[t];if(n){n.end=this.l.now(),this.k(t,"end");var s=this.O(t),e=parseFloat(s.toFixed(2));return delete this.o[t],this.j((function(){i.log({metricName:t,duration:e}),i.sendTiming({metricName:t,duration:e})})),e}this.L(this.h+" stopped.")}},i.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var s=i.end(t);n(s)}))}))},i.prototype.F=function(t){return!!t||(this.L(this.s),!1)},i.prototype.D=function(t){this.I({entries:t,_:"First Input Delay",metricName:"firstInputDelay",q:"duration"}),this.config.largestContentfulPaint&&this.i&&this.M(this.i,"Largest Contentful Paint","largestContentfulPaint"),this.B()},i.prototype.B=function(){this.R&&(clearTimeout(this.R),this.N("dataConsumption",this.dataConsumption))},i.prototype.S=function(){try{this.m.firstInputDelay=this.A("first-input",this.D.bind(this))}catch(t){this.L("FID:failed")}},i.prototype.G=function(){var t=this;try{this.m.firstContentfulPaint=this.A("paint",(function(i){t.I({entries:i,H:"first-paint",_:"First Paint",metricName:"firstPaint",q:"startTime"}),t.I({entries:i,H:"first-contentful-paint",_:"First Contentful Paint",metricName:"firstContentfulPaint",q:"startTime"})}))}catch(t){this.L("FP:failed")}},i.prototype.J=function(){var t=this;try{this.m.largestContentfulPaint=this.A("largest-contentful-paint",(function(i){var n=i[i.length-1];t.i=n.K||n.U}))}catch(t){this.L("LCP:failed")}},i.prototype.P=function(){(this.config.firstPaint||this.config.firstContentfulPaint)&&this.G(),this.S(),this.J(),(this.config.resourceTiming||this.config.dataConsumption)&&this.V()},i.prototype.V=function(){var t=this;try{this.A("resource",(function(i){t.W({entries:i})}))}catch(t){this.L("DataConsumption:failed")}this.R=setTimeout((function(){t.B()}),15e3)},i.prototype.g=function(){return this.l&&!!this.l.getEntriesByType&&!!this.l.now&&!!this.l.mark},i.prototype.p=function(){return this.w.chrome&&"PerformanceObserver"in this.w},i.prototype.X=function(t){var i=this.l.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},i.prototype.C=function(){if(!this.config.navigationTiming)return{};if(!this.g()||Object.keys(this.u).length)return this.u;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.u;var i=t.responseStart,n=t.responseEnd;return this.u={fetchTime:n-t.fetchStart,workerTime:t.Y>0?n-t.Y:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.Z-t.$,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart},this.u},i.prototype.N=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))})),this.j((function(){n.log({metricName:t,data:i,suffix:""}),n.sendTiming({metricName:t,data:i})}))},i.prototype.M=function(t,i,n,s){var e=this;void 0===s&&(s="ms");var r=parseFloat(t.toFixed(2));r>this.config.maxMeasureTime||this.j((function(){e.log({metricName:i,duration:r,suffix:s}),e.sendTiming({metricName:n,duration:r})}))},i.prototype.log=function(i){var n=t({suffix:"ms"},i),s=n.metricName,e=n.data,r=n.duration,h=n.suffix;if(!this.t&&this.config.logging)if(s){var a="color: #ff6d00;font-size:11px;",o="%c "+this.config.logPrefix+" "+s+" ";if(r)o+=r.toFixed(2)+" "+h,this.c.log(o,a);else e&&this.c.log(o,a,e)}else this.L(this.s)},i.prototype.L=function(t){this.config.warning&&this.config.logging&&this.c.warn(this.config.logPrefix,t)},i.prototype.T=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.v)},i.prototype.k=function(t,i){var n="mark_"+t+"_"+i;this.l.mark(n)},i.prototype.O=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.l.measure(t,i,n),this.X(t)},i.prototype.A=function(t,i){return this.tt=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.tt.observe({type:t,buffered:!0}),this.tt},i.prototype.I=function(t){var i=this;t.entries.forEach((function(n){i.config[t.metricName]&&(!t.H||t.H&&n.name===t.H)&&i.M(n[t.q],t._,t.metricName),i.m.firstContentfulPaint&&"first-contentful-paint"===n.name&&i.m.firstContentfulPaint.disconnect()})),this.m.firstInputDelay&&"firstInputDelay"===t.metricName&&this.m.firstInputDelay.disconnect()},i.prototype.W=function(t){var i=this;t.entries.forEach((function(t){i.config.resourceTiming&&i.N("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType&&(i.dataConsumption[t.initiatorType]+=t.decodedBodySize/1e3)}))},i.prototype.j=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},i.prototype.sendTiming=function(t){var i=t.metricName,n=t.data,s=t.duration;this.t||this.config.analyticsTracker({metricName:i,data:n,duration:s})},i}()}(); | ||
var Perfume=function(){"use strict";return function(){function t(t){var i=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,warning:!1},this.c=window.console,this.d=document,this.dataConsumption={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.t=!1,this.i=0,this.s="Missing metric name",this.h="Recording already",this.o={},this.u={},this.m={},this.w=window,this.l=window.performance,this.v=function(){i.d.hidden&&(i.t=i.d.hidden)},this.config=Object.assign({},this.config,t),this.p()&&(this.g()&&this.T(),this.P(),this.config.navigationTiming&&this.N("navigationTiming",this.C()))}return t.prototype.start=function(t){this.k(t)&&this.p()&&(this.o[t]?this.F(this.h+" started."):(this.o[t]={end:0,start:this.l.now()},this._(t,"start"),this.t=!1))},t.prototype.end=function(t){var i=this;if(this.k(t)&&this.p()){var n=this.o[t];if(n){n.end=this.l.now(),this._(t,"end");var s=this.D(t),e=parseFloat(s.toFixed(2));return delete this.o[t],this.I((function(){i.log({metricName:t,duration:e}),i.L({metricName:t,duration:e})})),e}this.F(this.h+" stopped.")}},t.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var s=i.end(t);n(s)}))}))},t.prototype.k=function(t){return!!t||(this.F(this.s),!1)},t.prototype.O=function(t){this.j({q:t,metricName:"firstInputDelay",M:"duration"}),this.B(),this.R()},t.prototype.R=function(){this.S&&(clearTimeout(this.S),this.S=void 0,this.N("dataConsumption",this.dataConsumption))},t.prototype.B=function(){this.m.A&&this.i&&(this.G(this.i,"largestContentfulPaint"),this.m.A.disconnect())},t.prototype.H=function(){try{this.m.J=this.K("first-input",this.O.bind(this))}catch(t){this.F("FID:failed")}},t.prototype.U=function(){var t=this;try{this.m.V=this.K("paint",(function(i){t.j({q:i,W:"first-paint",metricName:"firstPaint",M:"startTime"}),t.j({q:i,W:"first-contentful-paint",metricName:"firstContentfulPaint",M:"startTime"})}))}catch(t){this.F("FP:failed")}},t.prototype.X=function(){var t=this;try{this.m.A=this.K("largest-contentful-paint",(function(i){var n=i.pop();n&&(t.i=n.renderTime||n.loadTime)}))}catch(t){this.F("LCP:failed")}},t.prototype.T=function(){(this.config.firstPaint||this.config.firstContentfulPaint)&&this.U(),this.H(),this.X(),(this.config.resourceTiming||this.config.dataConsumption)&&this.Y()},t.prototype.Y=function(){var t=this;try{this.K("resource",(function(i){t.Z({q:i})}))}catch(t){this.F("DataConsumption:failed")}this.S=setTimeout((function(){t.R()}),15e3)},t.prototype.p=function(){return this.l&&!!this.l.getEntriesByType&&!!this.l.now&&!!this.l.mark},t.prototype.g=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.$=function(t){var i=this.l.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},t.prototype.C=function(){if(!this.config.navigationTiming)return{};if(!this.p()||Object.keys(this.u).length)return this.u;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.u;var i=t.responseStart,n=t.responseEnd;return this.u={fetchTime:n-t.fetchStart,workerTime:t.tt>0?n-t.tt:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.it-t.nt||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart},this.u},t.prototype.N=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))})),this.I((function(){n.log({metricName:t,data:i,suffix:""}),n.L({metricName:t,data:i})}))},t.prototype.G=function(t,i,n){var s=this;void 0===n&&(n="ms");var e=parseFloat(t.toFixed(2));e>this.config.maxMeasureTime||e<=0||this.I((function(){s.log({metricName:i,duration:e,suffix:n}),s.L({metricName:i,duration:e})}))},t.prototype.log=function(t){if(!this.t&&this.config.logging)if(t.metricName){var i="color:#ff6d00;font-size:11px;",n="%c "+this.config.logPrefix+" "+t.metricName+" ";if(t.duration)n+=t.duration.toFixed(2)+" "+(t.suffix||"ms"),this.c.log(n,i);else t.data&&this.c.log(n,i,t.data)}else this.F(this.s)},t.prototype.F=function(t){this.config.warning&&this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.P=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.v)},t.prototype._=function(t,i){var n="mark_"+t+"_"+i;this.l.mark(n)},t.prototype.D=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.l.measure(t,i,n),this.$(t)},t.prototype.K=function(t,i){return this.st=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.st.observe({type:t,buffered:!0}),this.st},t.prototype.j=function(t){var i=this;t.q.forEach((function(n){i.config[t.metricName]&&(!t.W||t.W&&n.name===t.W)&&i.G(n[t.M],t.metricName),i.m.V&&"first-contentful-paint"===n.name&&i.m.V.disconnect()})),this.m.J&&"firstInputDelay"===t.metricName&&this.m.J.disconnect()},t.prototype.Z=function(t){var i=this;t.q.forEach((function(t){i.config.resourceTiming&&i.N("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType&&(i.dataConsumption[t.initiatorType]+=t.decodedBodySize/1e3)}))},t.prototype.I=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.L=function(t){var i=t.metricName,n=t.data,s=t.duration;this.t||this.config.analyticsTracker({metricName:i,data:n,duration:s})},t}()}(); | ||
//# sourceMappingURL=perfume.iife.min.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var __assign=function(){return(__assign=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var e in i=arguments[n])Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}).apply(this,arguments)},Perfume=function(){function t(t){var i=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,warning:!1},this.c=window.console,this.d=document,this.dataConsumption={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.t=!1,this.i=0,this.s="Missing metric name",this.h="Recording already",this.o={},this.u={},this.m={},this.w=window,this.l=window.performance,this.v=function(){i.d.hidden&&(i.t=i.d.hidden)},this.config=Object.assign({},this.config,t),this.g()&&(this.p()&&this.P(),this.T(),this.config.navigationTiming&&this.N("navigationTiming",this._()))}return t.prototype.start=function(t){this.C(t)&&this.g()&&(this.o[t]?this.F(this.h+" started."):(this.o[t]={end:0,start:this.l.now()},this.L(t,"start"),this.t=!1))},t.prototype.end=function(t){var i=this;if(this.C(t)&&this.g()){var n=this.o[t];if(n){n.end=this.l.now(),this.L(t,"end");var s=this.k(t),e=parseFloat(s.toFixed(2));return delete this.o[t],this.O((function(){i.log({metricName:t,duration:e}),i.sendTiming({metricName:t,duration:e})})),e}this.F(this.h+" stopped.")}},t.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var s=i.end(t);n(s)}))}))},t.prototype.C=function(t){return!!t||(this.F(this.s),!1)},t.prototype.j=function(t){this.D({entries:t,I:"First Input Delay",metricName:"firstInputDelay",q:"duration"}),this.config.largestContentfulPaint&&this.i&&this.M(this.i,"Largest Contentful Paint","largestContentfulPaint"),this.B()},t.prototype.B=function(){this.R&&(clearTimeout(this.R),this.N("dataConsumption",this.dataConsumption))},t.prototype.S=function(){try{this.m.firstInputDelay=this.A("first-input",this.j.bind(this))}catch(t){this.F("FID:failed")}},t.prototype.G=function(){var t=this;try{this.m.firstContentfulPaint=this.A("paint",(function(i){t.D({entries:i,H:"first-paint",I:"First Paint",metricName:"firstPaint",q:"startTime"}),t.D({entries:i,H:"first-contentful-paint",I:"First Contentful Paint",metricName:"firstContentfulPaint",q:"startTime"})}))}catch(t){this.F("FP:failed")}},t.prototype.J=function(){var t=this;try{this.m.largestContentfulPaint=this.A("largest-contentful-paint",(function(i){var n=i[i.length-1];t.i=n.K||n.U}))}catch(t){this.F("LCP:failed")}},t.prototype.P=function(){(this.config.firstPaint||this.config.firstContentfulPaint)&&this.G(),this.S(),this.J(),(this.config.resourceTiming||this.config.dataConsumption)&&this.V()},t.prototype.V=function(){var t=this;try{this.A("resource",(function(i){t.W({entries:i})}))}catch(t){this.F("DataConsumption:failed")}this.R=setTimeout((function(){t.B()}),15e3)},t.prototype.g=function(){return this.l&&!!this.l.getEntriesByType&&!!this.l.now&&!!this.l.mark},t.prototype.p=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.X=function(t){var i=this.l.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},t.prototype._=function(){if(!this.config.navigationTiming)return{};if(!this.g()||Object.keys(this.u).length)return this.u;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.u;var i=t.responseStart,n=t.responseEnd;return this.u={fetchTime:n-t.fetchStart,workerTime:t.Y>0?n-t.Y:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.Z-t.$,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart},this.u},t.prototype.N=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))})),this.O((function(){n.log({metricName:t,data:i,suffix:""}),n.sendTiming({metricName:t,data:i})}))},t.prototype.M=function(t,i,n,s){var e=this;void 0===s&&(s="ms");var r=parseFloat(t.toFixed(2));r>this.config.maxMeasureTime||this.O((function(){e.log({metricName:i,duration:r,suffix:s}),e.sendTiming({metricName:n,duration:r})}))},t.prototype.log=function(t){var i=__assign({suffix:"ms"},t),n=i.metricName,s=i.data,e=i.duration,r=i.suffix;if(!this.t&&this.config.logging)if(n){var h="color: #ff6d00;font-size:11px;",a="%c "+this.config.logPrefix+" "+n+" ";if(e)a+=e.toFixed(2)+" "+r,this.c.log(a,h);else s&&this.c.log(a,h,s)}else this.F(this.s)},t.prototype.F=function(t){this.config.warning&&this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.T=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.v)},t.prototype.L=function(t,i){var n="mark_"+t+"_"+i;this.l.mark(n)},t.prototype.k=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.l.measure(t,i,n),this.X(t)},t.prototype.A=function(t,i){return this.tt=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.tt.observe({type:t,buffered:!0}),this.tt},t.prototype.D=function(t){var i=this;t.entries.forEach((function(n){i.config[t.metricName]&&(!t.H||t.H&&n.name===t.H)&&i.M(n[t.q],t.I,t.metricName),i.m.firstContentfulPaint&&"first-contentful-paint"===n.name&&i.m.firstContentfulPaint.disconnect()})),this.m.firstInputDelay&&"firstInputDelay"===t.metricName&&this.m.firstInputDelay.disconnect()},t.prototype.W=function(t){var i=this;t.entries.forEach((function(t){i.config.resourceTiming&&i.N("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType&&(i.dataConsumption[t.initiatorType]+=t.decodedBodySize/1e3)}))},t.prototype.O=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.sendTiming=function(t){var i=t.metricName,n=t.data,s=t.duration;this.t||this.config.analyticsTracker({metricName:i,data:n,duration:s})},t}();module.exports=Perfume; | ||
"use strict";var Perfume=function(){function t(t){var i=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,warning:!1},this.c=window.console,this.d=document,this.dataConsumption={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.t=!1,this.i=0,this.s="Missing metric name",this.h="Recording already",this.o={},this.u={},this.m={},this.w=window,this.l=window.performance,this.v=function(){i.d.hidden&&(i.t=i.d.hidden)},this.config=Object.assign({},this.config,t),this.p()&&(this.g()&&this.T(),this.P(),this.config.navigationTiming&&this.N("navigationTiming",this.C()))}return t.prototype.start=function(t){this.k(t)&&this.p()&&(this.o[t]?this.F(this.h+" started."):(this.o[t]={end:0,start:this.l.now()},this._(t,"start"),this.t=!1))},t.prototype.end=function(t){var i=this;if(this.k(t)&&this.p()){var s=this.o[t];if(s){s.end=this.l.now(),this._(t,"end");var n=this.D(t),e=parseFloat(n.toFixed(2));return delete this.o[t],this.I((function(){i.log({metricName:t,duration:e}),i.L({metricName:t,duration:e})})),e}this.F(this.h+" stopped.")}},t.prototype.endPaint=function(t){var i=this;return new Promise((function(s){setTimeout((function(){var n=i.end(t);s(n)}))}))},t.prototype.k=function(t){return!!t||(this.F(this.s),!1)},t.prototype.O=function(t){this.j({q:t,metricName:"firstInputDelay",M:"duration"}),this.B(),this.R()},t.prototype.R=function(){this.S&&(clearTimeout(this.S),this.S=void 0,this.N("dataConsumption",this.dataConsumption))},t.prototype.B=function(){this.m.A&&this.i&&(this.G(this.i,"largestContentfulPaint"),this.m.A.disconnect())},t.prototype.H=function(){try{this.m.J=this.K("first-input",this.O.bind(this))}catch(t){this.F("FID:failed")}},t.prototype.U=function(){var t=this;try{this.m.V=this.K("paint",(function(i){t.j({q:i,W:"first-paint",metricName:"firstPaint",M:"startTime"}),t.j({q:i,W:"first-contentful-paint",metricName:"firstContentfulPaint",M:"startTime"})}))}catch(t){this.F("FP:failed")}},t.prototype.X=function(){var t=this;try{this.m.A=this.K("largest-contentful-paint",(function(i){var s=i.pop();s&&(t.i=s.renderTime||s.loadTime)}))}catch(t){this.F("LCP:failed")}},t.prototype.T=function(){(this.config.firstPaint||this.config.firstContentfulPaint)&&this.U(),this.H(),this.X(),(this.config.resourceTiming||this.config.dataConsumption)&&this.Y()},t.prototype.Y=function(){var t=this;try{this.K("resource",(function(i){t.Z({q:i})}))}catch(t){this.F("DataConsumption:failed")}this.S=setTimeout((function(){t.R()}),15e3)},t.prototype.p=function(){return this.l&&!!this.l.getEntriesByType&&!!this.l.now&&!!this.l.mark},t.prototype.g=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.$=function(t){var i=this.l.getEntriesByName(t),s=i[i.length-1];return s&&"measure"===s.entryType?s.duration:-1},t.prototype.C=function(){if(!this.config.navigationTiming)return{};if(!this.p()||Object.keys(this.u).length)return this.u;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.u;var i=t.responseStart,s=t.responseEnd;return this.u={fetchTime:s-t.fetchStart,workerTime:t.tt>0?s-t.tt:0,totalTime:s-t.requestStart,downloadTime:s-i,timeToFirstByte:i-t.requestStart,headerSize:t.it-t.st||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart},this.u},t.prototype.N=function(t,i){var s=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))})),this.I((function(){s.log({metricName:t,data:i,suffix:""}),s.L({metricName:t,data:i})}))},t.prototype.G=function(t,i,s){var n=this;void 0===s&&(s="ms");var e=parseFloat(t.toFixed(2));e>this.config.maxMeasureTime||e<=0||this.I((function(){n.log({metricName:i,duration:e,suffix:s}),n.L({metricName:i,duration:e})}))},t.prototype.log=function(t){if(!this.t&&this.config.logging)if(t.metricName){var i="color:#ff6d00;font-size:11px;",s="%c "+this.config.logPrefix+" "+t.metricName+" ";if(t.duration)s+=t.duration.toFixed(2)+" "+(t.suffix||"ms"),this.c.log(s,i);else t.data&&this.c.log(s,i,t.data)}else this.F(this.s)},t.prototype.F=function(t){this.config.warning&&this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.P=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.v)},t.prototype._=function(t,i){var s="mark_"+t+"_"+i;this.l.mark(s)},t.prototype.D=function(t){var i="mark_"+t+"_start",s="mark_"+t+"_end";return this.l.measure(t,i,s),this.$(t)},t.prototype.K=function(t,i){return this.nt=new PerformanceObserver((function(t){var s=t.getEntries();i(s)})),this.nt.observe({type:t,buffered:!0}),this.nt},t.prototype.j=function(t){var i=this;t.q.forEach((function(s){i.config[t.metricName]&&(!t.W||t.W&&s.name===t.W)&&i.G(s[t.M],t.metricName),i.m.V&&"first-contentful-paint"===s.name&&i.m.V.disconnect()})),this.m.J&&"firstInputDelay"===t.metricName&&this.m.J.disconnect()},t.prototype.Z=function(t){var i=this;t.q.forEach((function(t){i.config.resourceTiming&&i.N("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType&&(i.dataConsumption[t.initiatorType]+=t.decodedBodySize/1e3)}))},t.prototype.I=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.L=function(t){var i=t.metricName,s=t.data,n=t.duration;this.t||this.config.analyticsTracker({metricName:i,data:s,duration:n})},t}();module.exports=Perfume; | ||
//# sourceMappingURL=perfume.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t=t||self).t=i()}(this,(function(){"use strict";var t=function(){return(t=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var e in i=arguments[n])Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}).apply(this,arguments)};return function(){function i(t){var i=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,warning:!1},this.c=window.console,this.d=document,this.dataConsumption={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.i=!1,this.s=0,this.h="Missing metric name",this.o="Recording already",this.u={},this.m={},this.l={},this.w=window,this.v=window.performance,this.p=function(){i.d.hidden&&(i.i=i.d.hidden)},this.config=Object.assign({},this.config,t),this.g()&&(this.T()&&this.P(),this.N(),this.config.navigationTiming&&this.C("navigationTiming",this.F()))}return i.prototype.start=function(t){this.L(t)&&this.g()&&(this.u[t]?this.j(this.o+" started."):(this.u[t]={end:0,start:this.v.now()},this.k(t,"start"),this.i=!1))},i.prototype.end=function(t){var i=this;if(this.L(t)&&this.g()){var n=this.u[t];if(n){n.end=this.v.now(),this.k(t,"end");var s=this.O(t),e=parseFloat(s.toFixed(2));return delete this.u[t],this.D((function(){i.log({metricName:t,duration:e}),i.sendTiming({metricName:t,duration:e})})),e}this.j(this.o+" stopped.")}},i.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var s=i.end(t);n(s)}))}))},i.prototype.L=function(t){return!!t||(this.j(this.h),!1)},i.prototype.I=function(t){this._({entries:t,q:"First Input Delay",metricName:"firstInputDelay",M:"duration"}),this.config.largestContentfulPaint&&this.s&&this.B(this.s,"Largest Contentful Paint","largestContentfulPaint"),this.R()},i.prototype.R=function(){this.S&&(clearTimeout(this.S),this.C("dataConsumption",this.dataConsumption))},i.prototype.A=function(){try{this.l.firstInputDelay=this.G("first-input",this.I.bind(this))}catch(t){this.j("FID:failed")}},i.prototype.H=function(){var t=this;try{this.l.firstContentfulPaint=this.G("paint",(function(i){t._({entries:i,J:"first-paint",q:"First Paint",metricName:"firstPaint",M:"startTime"}),t._({entries:i,J:"first-contentful-paint",q:"First Contentful Paint",metricName:"firstContentfulPaint",M:"startTime"})}))}catch(t){this.j("FP:failed")}},i.prototype.K=function(){var t=this;try{this.l.largestContentfulPaint=this.G("largest-contentful-paint",(function(i){var n=i[i.length-1];t.s=n.U||n.V}))}catch(t){this.j("LCP:failed")}},i.prototype.P=function(){(this.config.firstPaint||this.config.firstContentfulPaint)&&this.H(),this.A(),this.K(),(this.config.resourceTiming||this.config.dataConsumption)&&this.W()},i.prototype.W=function(){var t=this;try{this.G("resource",(function(i){t.X({entries:i})}))}catch(t){this.j("DataConsumption:failed")}this.S=setTimeout((function(){t.R()}),15e3)},i.prototype.g=function(){return this.v&&!!this.v.getEntriesByType&&!!this.v.now&&!!this.v.mark},i.prototype.T=function(){return this.w.chrome&&"PerformanceObserver"in this.w},i.prototype.Y=function(t){var i=this.v.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},i.prototype.F=function(){if(!this.config.navigationTiming)return{};if(!this.g()||Object.keys(this.m).length)return this.m;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.m;var i=t.responseStart,n=t.responseEnd;return this.m={fetchTime:n-t.fetchStart,workerTime:t.Z>0?n-t.Z:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.$-t.tt,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart},this.m},i.prototype.C=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))})),this.D((function(){n.log({metricName:t,data:i,suffix:""}),n.sendTiming({metricName:t,data:i})}))},i.prototype.B=function(t,i,n,s){var e=this;void 0===s&&(s="ms");var r=parseFloat(t.toFixed(2));r>this.config.maxMeasureTime||this.D((function(){e.log({metricName:i,duration:r,suffix:s}),e.sendTiming({metricName:n,duration:r})}))},i.prototype.log=function(i){var n=t({suffix:"ms"},i),s=n.metricName,e=n.data,r=n.duration,h=n.suffix;if(!this.i&&this.config.logging)if(s){var a="color: #ff6d00;font-size:11px;",o="%c "+this.config.logPrefix+" "+s+" ";if(r)o+=r.toFixed(2)+" "+h,this.c.log(o,a);else e&&this.c.log(o,a,e)}else this.j(this.h)},i.prototype.j=function(t){this.config.warning&&this.config.logging&&this.c.warn(this.config.logPrefix,t)},i.prototype.N=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.p)},i.prototype.k=function(t,i){var n="mark_"+t+"_"+i;this.v.mark(n)},i.prototype.O=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.v.measure(t,i,n),this.Y(t)},i.prototype.G=function(t,i){return this.it=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.it.observe({type:t,buffered:!0}),this.it},i.prototype._=function(t){var i=this;t.entries.forEach((function(n){i.config[t.metricName]&&(!t.J||t.J&&n.name===t.J)&&i.B(n[t.M],t.q,t.metricName),i.l.firstContentfulPaint&&"first-contentful-paint"===n.name&&i.l.firstContentfulPaint.disconnect()})),this.l.firstInputDelay&&"firstInputDelay"===t.metricName&&this.l.firstInputDelay.disconnect()},i.prototype.X=function(t){var i=this;t.entries.forEach((function(t){i.config.resourceTiming&&i.C("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType&&(i.dataConsumption[t.initiatorType]+=t.decodedBodySize/1e3)}))},i.prototype.D=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},i.prototype.sendTiming=function(t){var i=t.metricName,n=t.data,s=t.duration;this.i||this.config.analyticsTracker({metricName:i,data:n,duration:s})},i}()})); | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t=t||self).t=i()}(this,(function(){"use strict";return function(){function t(t){var i=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,warning:!1},this.c=window.console,this.d=document,this.dataConsumption={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.i=!1,this.s=0,this.h="Missing metric name",this.o="Recording already",this.u={},this.m={},this.l={},this.w=window,this.v=window.performance,this.p=function(){i.d.hidden&&(i.i=i.d.hidden)},this.config=Object.assign({},this.config,t),this.g()&&(this.T()&&this.P(),this.N(),this.config.navigationTiming&&this.C("navigationTiming",this.k()))}return t.prototype.start=function(t){this.F(t)&&this.g()&&(this.u[t]?this._(this.o+" started."):(this.u[t]={end:0,start:this.v.now()},this.j(t,"start"),this.i=!1))},t.prototype.end=function(t){var i=this;if(this.F(t)&&this.g()){var n=this.u[t];if(n){n.end=this.v.now(),this.j(t,"end");var s=this.D(t),e=parseFloat(s.toFixed(2));return delete this.u[t],this.I((function(){i.log({metricName:t,duration:e}),i.L({metricName:t,duration:e})})),e}this._(this.o+" stopped.")}},t.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var s=i.end(t);n(s)}))}))},t.prototype.F=function(t){return!!t||(this._(this.h),!1)},t.prototype.O=function(t){this.q({M:t,metricName:"firstInputDelay",B:"duration"}),this.R(),this.S()},t.prototype.S=function(){this.A&&(clearTimeout(this.A),this.A=void 0,this.C("dataConsumption",this.dataConsumption))},t.prototype.R=function(){this.l.G&&this.s&&(this.H(this.s,"largestContentfulPaint"),this.l.G.disconnect())},t.prototype.J=function(){try{this.l.K=this.U("first-input",this.O.bind(this))}catch(t){this._("FID:failed")}},t.prototype.V=function(){var t=this;try{this.l.W=this.U("paint",(function(i){t.q({M:i,X:"first-paint",metricName:"firstPaint",B:"startTime"}),t.q({M:i,X:"first-contentful-paint",metricName:"firstContentfulPaint",B:"startTime"})}))}catch(t){this._("FP:failed")}},t.prototype.Y=function(){var t=this;try{this.l.G=this.U("largest-contentful-paint",(function(i){var n=i.pop();n&&(t.s=n.renderTime||n.loadTime)}))}catch(t){this._("LCP:failed")}},t.prototype.P=function(){(this.config.firstPaint||this.config.firstContentfulPaint)&&this.V(),this.J(),this.Y(),(this.config.resourceTiming||this.config.dataConsumption)&&this.Z()},t.prototype.Z=function(){var t=this;try{this.U("resource",(function(i){t.$({M:i})}))}catch(t){this._("DataConsumption:failed")}this.A=setTimeout((function(){t.S()}),15e3)},t.prototype.g=function(){return this.v&&!!this.v.getEntriesByType&&!!this.v.now&&!!this.v.mark},t.prototype.T=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.tt=function(t){var i=this.v.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},t.prototype.k=function(){if(!this.config.navigationTiming)return{};if(!this.g()||Object.keys(this.m).length)return this.m;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.m;var i=t.responseStart,n=t.responseEnd;return this.m={fetchTime:n-t.fetchStart,workerTime:t.it>0?n-t.it:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.nt-t.st||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart},this.m},t.prototype.C=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))})),this.I((function(){n.log({metricName:t,data:i,suffix:""}),n.L({metricName:t,data:i})}))},t.prototype.H=function(t,i,n){var s=this;void 0===n&&(n="ms");var e=parseFloat(t.toFixed(2));e>this.config.maxMeasureTime||e<=0||this.I((function(){s.log({metricName:i,duration:e,suffix:n}),s.L({metricName:i,duration:e})}))},t.prototype.log=function(t){if(!this.i&&this.config.logging)if(t.metricName){var i="color:#ff6d00;font-size:11px;",n="%c "+this.config.logPrefix+" "+t.metricName+" ";if(t.duration)n+=t.duration.toFixed(2)+" "+(t.suffix||"ms"),this.c.log(n,i);else t.data&&this.c.log(n,i,t.data)}else this._(this.h)},t.prototype._=function(t){this.config.warning&&this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.N=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.p)},t.prototype.j=function(t,i){var n="mark_"+t+"_"+i;this.v.mark(n)},t.prototype.D=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.v.measure(t,i,n),this.tt(t)},t.prototype.U=function(t,i){return this.et=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.et.observe({type:t,buffered:!0}),this.et},t.prototype.q=function(t){var i=this;t.M.forEach((function(n){i.config[t.metricName]&&(!t.X||t.X&&n.name===t.X)&&i.H(n[t.B],t.metricName),i.l.W&&"first-contentful-paint"===n.name&&i.l.W.disconnect()})),this.l.K&&"firstInputDelay"===t.metricName&&this.l.K.disconnect()},t.prototype.$=function(t){var i=this;t.M.forEach((function(t){i.config.resourceTiming&&i.C("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType&&(i.dataConsumption[t.initiatorType]+=t.decodedBodySize/1e3)}))},t.prototype.I=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.L=function(t){var i=t.metricName,n=t.data,s=t.duration;this.i||this.config.analyticsTracker({metricName:i,data:n,duration:s})},t}()})); | ||
//# sourceMappingURL=perfume.umd.min.js.map |
/*! | ||
* Perfume.js v4.1.0 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v4.2.0 (http://zizzamia.github.io/perfume) | ||
* Copyright 2018 The Perfume Authors (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
@@ -110,3 +110,3 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
private isHidden; | ||
private largestContentfulPaintDuration; | ||
private lcpDuration; | ||
private logMetricWarn; | ||
@@ -137,2 +137,3 @@ private logPrefixRecording; | ||
private disconnectDataConsumption; | ||
private disconnectlargestContentfulPaint; | ||
private initFirstInputDelay; | ||
@@ -139,0 +140,0 @@ /** |
{ | ||
"name": "perfume.js", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "JavaScript library that measures Navigation Timing, First (Contentful) Paint (FP/FCP), First Input Delay (FID) and components lifecycle performance. Report real user measurements to your favorite analytics tool.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -5,3 +5,3 @@ <a href="http://www.perfumejs.com/"> | ||
# [Perfume.js v4.1.0](http://perfumejs.com) | ||
# [Perfume.js v4.2.0](http://perfumejs.com) | ||
@@ -8,0 +8,0 @@ [![NPM version](https://badge.fury.io/js/perfume.js.svg)](https://www.npmjs.org/package/perfume.js) [![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) [![Test Coverage](https://api.codeclimate.com/v1/badges/f813d2f45b274d93b8c5/test_coverage)](https://codeclimate.com/github/Zizzamia/perfume.js/test_coverage) [![JS gzip size](https://img.badgesize.io/https://unpkg.com/perfume.js?compression=gzip&label=JS+gzip+size)](https://unpkg.com/perfume.js) |
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
340411
2015