perfume.js
Advanced tools
Comparing version 4.7.3 to 4.7.4
{ | ||
"name": "perfume.js/angular", | ||
"version": "4.7.3", | ||
"version": "4.7.4", | ||
"peerDependencies": { | ||
"@angular/common": "^6.0.0", | ||
"@angular/core": "^6.0.0", | ||
"perfume.js": "4.7.2", | ||
"perfume.js": "4.7.3", | ||
"tslib": "^1.10.0" | ||
@@ -9,0 +9,0 @@ }, |
# Changelog | ||
## 4.7.4 (2020-2-22) | ||
* **fix:** replaced isLowEnd with isLowEndDevice and isLowEndExperience | ||
## 4.7.3 (2020-2-21) | ||
@@ -4,0 +8,0 @@ |
@@ -17,3 +17,3 @@ var Perfume = /** @class */ (function () { | ||
this.copyright = '© 2020 Leonardo Zizzamia'; | ||
this.version = '4.7.3'; | ||
this.version = '4.7.4'; | ||
this.c = window.console; | ||
@@ -40,2 +40,3 @@ this.d = document; | ||
this.et = '4g'; | ||
this.sd = false; | ||
this.didVisibilityChange = function () { | ||
@@ -70,2 +71,37 @@ if (_this.d.hidden) { | ||
} | ||
Object.defineProperty(Perfume.prototype, "isLowEndDevice", { | ||
get: function () { | ||
// If number of logical processors available to run threads <= 4 | ||
if (this.wn.hardwareConcurrency && | ||
this.wn.hardwareConcurrency <= 4) { | ||
return true; | ||
} | ||
// If the approximate amount of RAM client device has <= 4 | ||
if (this.wn.deviceMemory && this.wn.deviceMemory <= 4) { | ||
return true; | ||
} | ||
return false; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Perfume.prototype, "isLowEndExperience", { | ||
get: function () { | ||
if (this.isLowEndDevice) { | ||
return true; | ||
} | ||
// If the effective type of the connection meaning | ||
// one of 'slow-2g', '2g', '3g', or '4g' is !== 4g | ||
if (['slow-2g', '2g', '3g'].includes(this.et)) { | ||
return true; | ||
} | ||
// Data Saver preference | ||
if (this.sd) { | ||
return true; | ||
} | ||
return false; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -109,3 +145,4 @@ * Start performance measurement | ||
var navigatorInfo = _this.getNavigatorInfo(); | ||
navigatorInfo.isLowEnd = _this.isAdaptiveLoading(); | ||
navigatorInfo.isLowEndDevice = _this.isLowEndDevice; | ||
navigatorInfo.isLowEndExperience = _this.isLowEndExperience; | ||
var options = { | ||
@@ -215,19 +252,2 @@ measureName: markName, | ||
}; | ||
Perfume.prototype.isAdaptiveLoading = function () { | ||
// If number of logical processors available to run threads <= 4 | ||
if (this.wn.hardwareConcurrency && | ||
this.wn.hardwareConcurrency <= 4) { | ||
return true; | ||
} | ||
// If the approximate amount of RAM client device has <= 4 | ||
if (this.wn.deviceMemory && this.wn.deviceMemory <= 4) { | ||
return true; | ||
} | ||
// If the effective type of the connection meaning | ||
// one of 'slow-2g', '2g', '3g', or '4g' is !== 4g | ||
if (['slow-2g', '2g', '3g'].includes(this.et)) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
/** | ||
@@ -322,2 +342,3 @@ * True if the browser supports the Navigation Timing API, | ||
this.et = dataConnection.effectiveType; | ||
this.sd = !!dataConnection.saveData; | ||
return { | ||
@@ -340,3 +361,4 @@ downlink: dataConnection.downlink, | ||
var navigatorInfo = this.getNavigatorInfo(); | ||
navigatorInfo.isLowEnd = this.isAdaptiveLoading(); | ||
navigatorInfo.isLowEndDevice = this.isLowEndDevice; | ||
navigatorInfo.isLowEndExperience = this.isLowEndExperience; | ||
this.pushTask(function () { | ||
@@ -363,3 +385,4 @@ // Logs the metric in the internal console.log | ||
var navigatorInfo = this.getNavigatorInfo(); | ||
navigatorInfo.isLowEnd = this.isAdaptiveLoading(); | ||
navigatorInfo.isLowEndDevice = this.isLowEndDevice; | ||
navigatorInfo.isLowEndExperience = this.isLowEndExperience; | ||
this.pushTask(function () { | ||
@@ -366,0 +389,0 @@ // Logs the metric in the internal console.log |
@@ -19,3 +19,3 @@ "use strict"; | ||
this.copyright = '© 2020 Leonardo Zizzamia'; | ||
this.version = '4.7.3'; | ||
this.version = '4.7.4'; | ||
this.c = window.console; | ||
@@ -42,2 +42,3 @@ this.d = document; | ||
this.et = '4g'; | ||
this.sd = false; | ||
this.didVisibilityChange = function () { | ||
@@ -72,2 +73,37 @@ if (_this.d.hidden) { | ||
} | ||
Object.defineProperty(Perfume.prototype, "isLowEndDevice", { | ||
get: function () { | ||
// If number of logical processors available to run threads <= 4 | ||
if (this.wn.hardwareConcurrency && | ||
this.wn.hardwareConcurrency <= 4) { | ||
return true; | ||
} | ||
// If the approximate amount of RAM client device has <= 4 | ||
if (this.wn.deviceMemory && this.wn.deviceMemory <= 4) { | ||
return true; | ||
} | ||
return false; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Perfume.prototype, "isLowEndExperience", { | ||
get: function () { | ||
if (this.isLowEndDevice) { | ||
return true; | ||
} | ||
// If the effective type of the connection meaning | ||
// one of 'slow-2g', '2g', '3g', or '4g' is !== 4g | ||
if (['slow-2g', '2g', '3g'].includes(this.et)) { | ||
return true; | ||
} | ||
// Data Saver preference | ||
if (this.sd) { | ||
return true; | ||
} | ||
return false; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -111,3 +147,4 @@ * Start performance measurement | ||
var navigatorInfo = _this.getNavigatorInfo(); | ||
navigatorInfo.isLowEnd = _this.isAdaptiveLoading(); | ||
navigatorInfo.isLowEndDevice = _this.isLowEndDevice; | ||
navigatorInfo.isLowEndExperience = _this.isLowEndExperience; | ||
var options = { | ||
@@ -217,19 +254,2 @@ measureName: markName, | ||
}; | ||
Perfume.prototype.isAdaptiveLoading = function () { | ||
// If number of logical processors available to run threads <= 4 | ||
if (this.wn.hardwareConcurrency && | ||
this.wn.hardwareConcurrency <= 4) { | ||
return true; | ||
} | ||
// If the approximate amount of RAM client device has <= 4 | ||
if (this.wn.deviceMemory && this.wn.deviceMemory <= 4) { | ||
return true; | ||
} | ||
// If the effective type of the connection meaning | ||
// one of 'slow-2g', '2g', '3g', or '4g' is !== 4g | ||
if (['slow-2g', '2g', '3g'].includes(this.et)) { | ||
return true; | ||
} | ||
return false; | ||
}; | ||
/** | ||
@@ -324,2 +344,3 @@ * True if the browser supports the Navigation Timing API, | ||
this.et = dataConnection.effectiveType; | ||
this.sd = !!dataConnection.saveData; | ||
return { | ||
@@ -342,3 +363,4 @@ downlink: dataConnection.downlink, | ||
var navigatorInfo = this.getNavigatorInfo(); | ||
navigatorInfo.isLowEnd = this.isAdaptiveLoading(); | ||
navigatorInfo.isLowEndDevice = this.isLowEndDevice; | ||
navigatorInfo.isLowEndExperience = this.isLowEndExperience; | ||
this.pushTask(function () { | ||
@@ -365,3 +387,4 @@ // Logs the metric in the internal console.log | ||
var navigatorInfo = this.getNavigatorInfo(); | ||
navigatorInfo.isLowEnd = this.isAdaptiveLoading(); | ||
navigatorInfo.isLowEndDevice = this.isLowEndDevice; | ||
navigatorInfo.isLowEndExperience = this.isLowEndExperience; | ||
this.pushTask(function () { | ||
@@ -368,0 +391,0 @@ // Logs the metric in the internal console.log |
@@ -1,2 +0,2 @@ | ||
var t=function(){function t(t){var i=this;if(void 0===t&&(t={}),this.config={dataConsumption:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},this.t="© 2020 Leonardo Zizzamia",this.version="4.7.3",this.c=window.console,this.d=document,this.i=!1,this.s=0,this.h="Recording already",this.o={},this.u={},this.m={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.w=window,this.v=window.performance,this.l=window.navigator,this.p="4g",this.g=function(){i.d.hidden&&(i.i=i.d.hidden)},this.config=Object.assign({},this.config,t),this.T()){if(this.k())try{this._()}catch(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)}this.N(),this.I("navigationTiming",this.P()),this.I("networkInformation",this.C())}}return t.prototype.start=function(t){this.T()&&(this.o[t]?this.L(this.h+" started."):(this.o[t]=!0,this.v.mark("mark_"+t+"_start"),this.i=!1))},t.prototype.end=function(t,i){var n=this;if(void 0===i&&(i={}),this.T())if(this.o[t]){this.v.mark("mark_"+t+"_end");var s=this.j(t),e=parseFloat(s.toFixed(2));delete this.o[t],this.F((function(){var s=n.O();s.isLowEnd=n.D();var r={q:t,data:e,duration:e,M:i,B:s};n.log(r),n.R(r)}))}else this.L(this.h+" stopped.")},t.prototype.endPaint=function(t,i){var n=this;setTimeout((function(){n.end(t,i)}))},t.prototype.clear=function(t){this.v.clearMarks("mark_"+t+"_start"),this.v.clearMarks("mark_"+t+"_end"),delete this.o[t]},t.prototype.S=function(t){this.Z({A:t,q:"firstInputDelay",G:"duration"}),this.H(),this.J()},t.prototype.J=function(){this.K&&(clearTimeout(this.K),this.K=void 0,this.I("dataConsumption",this.m))},t.prototype.H=function(){this.u.U&&this.s&&(this.V(this.s,"largestContentfulPaint"),this.u.U.disconnect())},t.prototype.W=function(){this.u.X=this.Y("first-input",this.S.bind(this))},t.prototype.$=function(){var t=this;this.u.tt=this.Y("paint",(function(i){t.Z({A:i,it:"first-paint",q:"firstPaint",G:"startTime"}),t.Z({A:i,it:"first-contentful-paint",q:"firstContentfulPaint",G:"startTime"})}))},t.prototype.nt=function(){var t=this;this.u.U=this.Y("largest-contentful-paint",(function(i){var n=i.pop();n&&(t.s=n.renderTime||n.loadTime)}))},t.prototype._=function(){this.$(),this.W(),this.nt(),(this.config.resourceTiming||this.config.dataConsumption)&&this.st()},t.prototype.st=function(){var t=this;this.Y("resource",(function(i){t.et({A:i})})),this.K=setTimeout((function(){t.J()}),15e3)},t.prototype.D=function(){return!!(this.l.hardwareConcurrency&&this.l.hardwareConcurrency<=4)||(!!(this.l.deviceMemory&&this.l.deviceMemory<=4)||!!["slow-2g","2g","3g"].includes(this.p))},t.prototype.T=function(){return this.v&&!!this.v.getEntriesByType&&!!this.v.now&&!!this.v.mark},t.prototype.k=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.rt=function(t){var i=this.v.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},t.prototype.O=function(){return this.l?{deviceMemory:this.l.deviceMemory?this.l.deviceMemory:0,hardwareConcurrency:this.l.hardwareConcurrency?this.l.hardwareConcurrency:0}:{}},t.prototype.P=function(){if(!this.T())return{};var t=performance.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,n=t.responseEnd;return{fetchTime:n-t.fetchStart,workerTime:t.workerStart>0?n-t.workerStart:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}},t.prototype.C=function(){if("connection"in this.l){var t=this.l.connection;return"object"!=typeof t?{}:(this.p=t.effectiveType,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}},t.prototype.I=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var s=this.O();s.isLowEnd=this.D(),this.F((function(){n.log({q:t,data:i,B:s}),n.R({q:t,data:i,B:s})}))},t.prototype.V=function(t,i,n){var s=this;void 0===n&&(n="ms");var e=parseFloat(t.toFixed(2));if(!(e>this.config.maxMeasureTime||e<=0)){var r=this.O();r.isLowEnd=this.D(),this.F((function(){s.log({q:i,data:e+" "+n,B:r}),s.R({q:i,duration:e,B:r})}))}},t.prototype.log=function(t){if(!this.i&&this.config.logging){this.c.log("%c "+this.config.logPrefix+" "+t.q+" ","color:#ff6d00;font-size:11px;",t.data,t.B)}},t.prototype.L=function(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.N=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.g)},t.prototype.j=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.v.measure(t,i,n),this.rt(t)},t.prototype.Y=function(t,i){return this.at=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.at.observe({type:t,buffered:!0}),this.at},t.prototype.Z=function(t){var i=this;t.A.forEach((function(n){(!t.it||t.it&&n.name===t.it)&&i.V(n[t.G],t.q),i.u.tt&&"first-contentful-paint"===n.name&&i.u.tt.disconnect()})),this.u.X&&"firstInputDelay"===t.q&&this.u.X.disconnect()},t.prototype.et=function(t){var i=this;t.A.forEach((function(t){if(i.config.resourceTiming&&i.I("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType){var n=t.decodedBodySize/1e3;i.m[t.initiatorType]+=n,i.m.total+=n}}))},t.prototype.F=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.R=function(t){if(!this.i){var i=t.q,n=t.data,s=t.duration,e=t.M,r=t.B,a=e||{};this.config.analyticsTracker({metricName:i,data:n,duration:s,eventProperties:a,navigatorInformation:r})}},t}();export default t; | ||
var t=function(){function t(t){var i=this;if(void 0===t&&(t={}),this.config={dataConsumption:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},this.t="© 2020 Leonardo Zizzamia",this.version="4.7.4",this.c=window.console,this.d=document,this.i=!1,this.s=0,this.h="Recording already",this.o={},this.u={},this.m={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.w=window,this.v=window.performance,this.l=window.navigator,this.p="4g",this.g=!1,this.T=function(){i.d.hidden&&(i.i=i.d.hidden)},this.config=Object.assign({},this.config,t),this.k()){if(this._())try{this.N()}catch(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)}this.I(),this.P("navigationTiming",this.L()),this.P("networkInformation",this.j())}}return Object.defineProperty(t.prototype,"C",{get:function(){return!!(this.l.hardwareConcurrency&&this.l.hardwareConcurrency<=4)||!!(this.l.deviceMemory&&this.l.deviceMemory<=4)},O:!0,D:!0}),Object.defineProperty(t.prototype,"F",{get:function(){return!!this.C||(!!["slow-2g","2g","3g"].includes(this.p)||!!this.g)},O:!0,D:!0}),t.prototype.start=function(t){this.k()&&(this.o[t]?this.q(this.h+" started."):(this.o[t]=!0,this.v.mark("mark_"+t+"_start"),this.i=!1))},t.prototype.end=function(t,i){var n=this;if(void 0===i&&(i={}),this.k())if(this.o[t]){this.v.mark("mark_"+t+"_end");var s=this.M(t),e=parseFloat(s.toFixed(2));delete this.o[t],this.B((function(){var s=n.R();s.C=n.C,s.F=n.F;var r={S:t,data:e,duration:e,Z:i,A:s};n.log(r),n.G(r)}))}else this.q(this.h+" stopped.")},t.prototype.endPaint=function(t,i){var n=this;setTimeout((function(){n.end(t,i)}))},t.prototype.clear=function(t){this.v.clearMarks("mark_"+t+"_start"),this.v.clearMarks("mark_"+t+"_end"),delete this.o[t]},t.prototype.H=function(t){this.J({K:t,S:"firstInputDelay",U:"duration"}),this.V(),this.W()},t.prototype.W=function(){this.X&&(clearTimeout(this.X),this.X=void 0,this.P("dataConsumption",this.m))},t.prototype.V=function(){this.u.Y&&this.s&&(this.$(this.s,"largestContentfulPaint"),this.u.Y.disconnect())},t.prototype.tt=function(){this.u.it=this.nt("first-input",this.H.bind(this))},t.prototype.st=function(){var t=this;this.u.et=this.nt("paint",(function(i){t.J({K:i,rt:"first-paint",S:"firstPaint",U:"startTime"}),t.J({K:i,rt:"first-contentful-paint",S:"firstContentfulPaint",U:"startTime"})}))},t.prototype.at=function(){var t=this;this.u.Y=this.nt("largest-contentful-paint",(function(i){var n=i.pop();n&&(t.s=n.renderTime||n.loadTime)}))},t.prototype.N=function(){this.st(),this.tt(),this.at(),(this.config.resourceTiming||this.config.dataConsumption)&&this.ht()},t.prototype.ht=function(){var t=this;this.nt("resource",(function(i){t.ot({K:i})})),this.X=setTimeout((function(){t.W()}),15e3)},t.prototype.k=function(){return this.v&&!!this.v.getEntriesByType&&!!this.v.now&&!!this.v.mark},t.prototype._=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.ut=function(t){var i=this.v.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},t.prototype.R=function(){return this.l?{deviceMemory:this.l.deviceMemory?this.l.deviceMemory:0,hardwareConcurrency:this.l.hardwareConcurrency?this.l.hardwareConcurrency:0}:{}},t.prototype.L=function(){if(!this.k())return{};var t=performance.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,n=t.responseEnd;return{fetchTime:n-t.fetchStart,workerTime:t.workerStart>0?n-t.workerStart:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}},t.prototype.j=function(){if("connection"in this.l){var t=this.l.connection;return"object"!=typeof t?{}:(this.p=t.effectiveType,this.g=!!t.saveData,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}},t.prototype.P=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var s=this.R();s.C=this.C,s.F=this.F,this.B((function(){n.log({S:t,data:i,A:s}),n.G({S:t,data:i,A:s})}))},t.prototype.$=function(t,i,n){var s=this;void 0===n&&(n="ms");var e=parseFloat(t.toFixed(2));if(!(e>this.config.maxMeasureTime||e<=0)){var r=this.R();r.C=this.C,r.F=this.F,this.B((function(){s.log({S:i,data:e+" "+n,A:r}),s.G({S:i,duration:e,A:r})}))}},t.prototype.log=function(t){if(!this.i&&this.config.logging){this.c.log("%c "+this.config.logPrefix+" "+t.S+" ","color:#ff6d00;font-size:11px;",t.data,t.A)}},t.prototype.q=function(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.I=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.T)},t.prototype.M=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.v.measure(t,i,n),this.ut(t)},t.prototype.nt=function(t,i){return this.ft=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.ft.observe({type:t,buffered:!0}),this.ft},t.prototype.J=function(t){var i=this;t.K.forEach((function(n){(!t.rt||t.rt&&n.name===t.rt)&&i.$(n[t.U],t.S),i.u.et&&"first-contentful-paint"===n.name&&i.u.et.disconnect()})),this.u.it&&"firstInputDelay"===t.S&&this.u.it.disconnect()},t.prototype.ot=function(t){var i=this;t.K.forEach((function(t){if(i.config.resourceTiming&&i.P("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType){var n=t.decodedBodySize/1e3;i.m[t.initiatorType]+=n,i.m.total+=n}}))},t.prototype.B=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.G=function(t){if(!this.i){var i=t.S,n=t.data,s=t.duration,e=t.Z,r=t.A,a=e||{};this.config.analyticsTracker({metricName:i,data:n,duration:s,eventProperties:a,navigatorInformation:r})}},t}();export default t; | ||
//# sourceMappingURL=perfume.esm.min.js.map |
@@ -1,2 +0,2 @@ | ||
var Perfume=function(){"use strict";return function(){function t(t){var i=this;if(void 0===t&&(t={}),this.config={dataConsumption:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},this.t="© 2020 Leonardo Zizzamia",this.version="4.7.3",this.c=window.console,this.d=document,this.i=!1,this.s=0,this.h="Recording already",this.o={},this.u={},this.m={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.w=window,this.v=window.performance,this.l=window.navigator,this.p="4g",this.g=function(){i.d.hidden&&(i.i=i.d.hidden)},this.config=Object.assign({},this.config,t),this.T()){if(this.k())try{this._()}catch(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)}this.N(),this.I("navigationTiming",this.P()),this.I("networkInformation",this.C())}}return t.prototype.start=function(t){this.T()&&(this.o[t]?this.L(this.h+" started."):(this.o[t]=!0,this.v.mark("mark_"+t+"_start"),this.i=!1))},t.prototype.end=function(t,i){var n=this;if(void 0===i&&(i={}),this.T())if(this.o[t]){this.v.mark("mark_"+t+"_end");var s=this.j(t),e=parseFloat(s.toFixed(2));delete this.o[t],this.F((function(){var s=n.O();s.isLowEnd=n.D();var r={q:t,data:e,duration:e,M:i,B:s};n.log(r),n.R(r)}))}else this.L(this.h+" stopped.")},t.prototype.endPaint=function(t,i){var n=this;setTimeout((function(){n.end(t,i)}))},t.prototype.clear=function(t){this.v.clearMarks("mark_"+t+"_start"),this.v.clearMarks("mark_"+t+"_end"),delete this.o[t]},t.prototype.S=function(t){this.Z({A:t,q:"firstInputDelay",G:"duration"}),this.H(),this.J()},t.prototype.J=function(){this.K&&(clearTimeout(this.K),this.K=void 0,this.I("dataConsumption",this.m))},t.prototype.H=function(){this.u.U&&this.s&&(this.V(this.s,"largestContentfulPaint"),this.u.U.disconnect())},t.prototype.W=function(){this.u.X=this.Y("first-input",this.S.bind(this))},t.prototype.$=function(){var t=this;this.u.tt=this.Y("paint",(function(i){t.Z({A:i,it:"first-paint",q:"firstPaint",G:"startTime"}),t.Z({A:i,it:"first-contentful-paint",q:"firstContentfulPaint",G:"startTime"})}))},t.prototype.nt=function(){var t=this;this.u.U=this.Y("largest-contentful-paint",(function(i){var n=i.pop();n&&(t.s=n.renderTime||n.loadTime)}))},t.prototype._=function(){this.$(),this.W(),this.nt(),(this.config.resourceTiming||this.config.dataConsumption)&&this.st()},t.prototype.st=function(){var t=this;this.Y("resource",(function(i){t.et({A:i})})),this.K=setTimeout((function(){t.J()}),15e3)},t.prototype.D=function(){return!!(this.l.hardwareConcurrency&&this.l.hardwareConcurrency<=4)||(!!(this.l.deviceMemory&&this.l.deviceMemory<=4)||!!["slow-2g","2g","3g"].includes(this.p))},t.prototype.T=function(){return this.v&&!!this.v.getEntriesByType&&!!this.v.now&&!!this.v.mark},t.prototype.k=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.rt=function(t){var i=this.v.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},t.prototype.O=function(){return this.l?{deviceMemory:this.l.deviceMemory?this.l.deviceMemory:0,hardwareConcurrency:this.l.hardwareConcurrency?this.l.hardwareConcurrency:0}:{}},t.prototype.P=function(){if(!this.T())return{};var t=performance.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,n=t.responseEnd;return{fetchTime:n-t.fetchStart,workerTime:t.workerStart>0?n-t.workerStart:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}},t.prototype.C=function(){if("connection"in this.l){var t=this.l.connection;return"object"!=typeof t?{}:(this.p=t.effectiveType,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}},t.prototype.I=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var s=this.O();s.isLowEnd=this.D(),this.F((function(){n.log({q:t,data:i,B:s}),n.R({q:t,data:i,B:s})}))},t.prototype.V=function(t,i,n){var s=this;void 0===n&&(n="ms");var e=parseFloat(t.toFixed(2));if(!(e>this.config.maxMeasureTime||e<=0)){var r=this.O();r.isLowEnd=this.D(),this.F((function(){s.log({q:i,data:e+" "+n,B:r}),s.R({q:i,duration:e,B:r})}))}},t.prototype.log=function(t){if(!this.i&&this.config.logging){this.c.log("%c "+this.config.logPrefix+" "+t.q+" ","color:#ff6d00;font-size:11px;",t.data,t.B)}},t.prototype.L=function(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.N=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.g)},t.prototype.j=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.v.measure(t,i,n),this.rt(t)},t.prototype.Y=function(t,i){return this.at=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.at.observe({type:t,buffered:!0}),this.at},t.prototype.Z=function(t){var i=this;t.A.forEach((function(n){(!t.it||t.it&&n.name===t.it)&&i.V(n[t.G],t.q),i.u.tt&&"first-contentful-paint"===n.name&&i.u.tt.disconnect()})),this.u.X&&"firstInputDelay"===t.q&&this.u.X.disconnect()},t.prototype.et=function(t){var i=this;t.A.forEach((function(t){if(i.config.resourceTiming&&i.I("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType){var n=t.decodedBodySize/1e3;i.m[t.initiatorType]+=n,i.m.total+=n}}))},t.prototype.F=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.R=function(t){if(!this.i){var i=t.q,n=t.data,s=t.duration,e=t.M,r=t.B,a=e||{};this.config.analyticsTracker({metricName:i,data:n,duration:s,eventProperties:a,navigatorInformation:r})}},t}()}(); | ||
var Perfume=function(){"use strict";return function(){function t(t){var i=this;if(void 0===t&&(t={}),this.config={dataConsumption:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},this.t="© 2020 Leonardo Zizzamia",this.version="4.7.4",this.c=window.console,this.d=document,this.i=!1,this.s=0,this.h="Recording already",this.o={},this.u={},this.m={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.w=window,this.v=window.performance,this.l=window.navigator,this.g="4g",this.p=!1,this.T=function(){i.d.hidden&&(i.i=i.d.hidden)},this.config=Object.assign({},this.config,t),this.k()){if(this._())try{this.N()}catch(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)}this.I(),this.P("navigationTiming",this.L()),this.P("networkInformation",this.j())}}return Object.defineProperty(t.prototype,"C",{get:function(){return!!(this.l.hardwareConcurrency&&this.l.hardwareConcurrency<=4)||!!(this.l.deviceMemory&&this.l.deviceMemory<=4)},O:!0,D:!0}),Object.defineProperty(t.prototype,"F",{get:function(){return!!this.C||(!!["slow-2g","2g","3g"].includes(this.g)||!!this.p)},O:!0,D:!0}),t.prototype.start=function(t){this.k()&&(this.o[t]?this.q(this.h+" started."):(this.o[t]=!0,this.v.mark("mark_"+t+"_start"),this.i=!1))},t.prototype.end=function(t,i){var n=this;if(void 0===i&&(i={}),this.k())if(this.o[t]){this.v.mark("mark_"+t+"_end");var s=this.M(t),e=parseFloat(s.toFixed(2));delete this.o[t],this.B((function(){var s=n.R();s.C=n.C,s.F=n.F;var r={S:t,data:e,duration:e,Z:i,A:s};n.log(r),n.G(r)}))}else this.q(this.h+" stopped.")},t.prototype.endPaint=function(t,i){var n=this;setTimeout((function(){n.end(t,i)}))},t.prototype.clear=function(t){this.v.clearMarks("mark_"+t+"_start"),this.v.clearMarks("mark_"+t+"_end"),delete this.o[t]},t.prototype.H=function(t){this.J({K:t,S:"firstInputDelay",U:"duration"}),this.V(),this.W()},t.prototype.W=function(){this.X&&(clearTimeout(this.X),this.X=void 0,this.P("dataConsumption",this.m))},t.prototype.V=function(){this.u.Y&&this.s&&(this.$(this.s,"largestContentfulPaint"),this.u.Y.disconnect())},t.prototype.tt=function(){this.u.it=this.nt("first-input",this.H.bind(this))},t.prototype.st=function(){var t=this;this.u.et=this.nt("paint",(function(i){t.J({K:i,rt:"first-paint",S:"firstPaint",U:"startTime"}),t.J({K:i,rt:"first-contentful-paint",S:"firstContentfulPaint",U:"startTime"})}))},t.prototype.at=function(){var t=this;this.u.Y=this.nt("largest-contentful-paint",(function(i){var n=i.pop();n&&(t.s=n.renderTime||n.loadTime)}))},t.prototype.N=function(){this.st(),this.tt(),this.at(),(this.config.resourceTiming||this.config.dataConsumption)&&this.ht()},t.prototype.ht=function(){var t=this;this.nt("resource",(function(i){t.ot({K:i})})),this.X=setTimeout((function(){t.W()}),15e3)},t.prototype.k=function(){return this.v&&!!this.v.getEntriesByType&&!!this.v.now&&!!this.v.mark},t.prototype._=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.ut=function(t){var i=this.v.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},t.prototype.R=function(){return this.l?{deviceMemory:this.l.deviceMemory?this.l.deviceMemory:0,hardwareConcurrency:this.l.hardwareConcurrency?this.l.hardwareConcurrency:0}:{}},t.prototype.L=function(){if(!this.k())return{};var t=performance.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,n=t.responseEnd;return{fetchTime:n-t.fetchStart,workerTime:t.workerStart>0?n-t.workerStart:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}},t.prototype.j=function(){if("connection"in this.l){var t=this.l.connection;return"object"!=typeof t?{}:(this.g=t.effectiveType,this.p=!!t.saveData,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}},t.prototype.P=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var s=this.R();s.C=this.C,s.F=this.F,this.B((function(){n.log({S:t,data:i,A:s}),n.G({S:t,data:i,A:s})}))},t.prototype.$=function(t,i,n){var s=this;void 0===n&&(n="ms");var e=parseFloat(t.toFixed(2));if(!(e>this.config.maxMeasureTime||e<=0)){var r=this.R();r.C=this.C,r.F=this.F,this.B((function(){s.log({S:i,data:e+" "+n,A:r}),s.G({S:i,duration:e,A:r})}))}},t.prototype.log=function(t){if(!this.i&&this.config.logging){this.c.log("%c "+this.config.logPrefix+" "+t.S+" ","color:#ff6d00;font-size:11px;",t.data,t.A)}},t.prototype.q=function(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.I=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.T)},t.prototype.M=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.v.measure(t,i,n),this.ut(t)},t.prototype.nt=function(t,i){return this.ft=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.ft.observe({type:t,buffered:!0}),this.ft},t.prototype.J=function(t){var i=this;t.K.forEach((function(n){(!t.rt||t.rt&&n.name===t.rt)&&i.$(n[t.U],t.S),i.u.et&&"first-contentful-paint"===n.name&&i.u.et.disconnect()})),this.u.it&&"firstInputDelay"===t.S&&this.u.it.disconnect()},t.prototype.ot=function(t){var i=this;t.K.forEach((function(t){if(i.config.resourceTiming&&i.P("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType){var n=t.decodedBodySize/1e3;i.m[t.initiatorType]+=n,i.m.total+=n}}))},t.prototype.B=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.G=function(t){if(!this.i){var i=t.S,n=t.data,s=t.duration,e=t.Z,r=t.A,a=e||{};this.config.analyticsTracker({metricName:i,data:n,duration:s,eventProperties:a,navigatorInformation:r})}},t}()}(); | ||
//# sourceMappingURL=perfume.iife.min.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var Perfume=function(){function t(t){var i=this;if(void 0===t&&(t={}),this.config={dataConsumption:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},this.t="© 2020 Leonardo Zizzamia",this.version="4.7.3",this.c=window.console,this.d=document,this.i=!1,this.s=0,this.h="Recording already",this.o={},this.u={},this.m={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.w=window,this.v=window.performance,this.l=window.navigator,this.p="4g",this.g=function(){i.d.hidden&&(i.i=i.d.hidden)},this.config=Object.assign({},this.config,t),this.T()){if(this.k())try{this._()}catch(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)}this.N(),this.P("navigationTiming",this.I()),this.P("networkInformation",this.C())}}return t.prototype.start=function(t){this.T()&&(this.o[t]?this.L(this.h+" started."):(this.o[t]=!0,this.v.mark("mark_"+t+"_start"),this.i=!1))},t.prototype.end=function(t,i){var n=this;if(void 0===i&&(i={}),this.T())if(this.o[t]){this.v.mark("mark_"+t+"_end");var s=this.j(t),e=parseFloat(s.toFixed(2));delete this.o[t],this.F((function(){var s=n.O();s.isLowEnd=n.D();var r={q:t,data:e,duration:e,M:i,B:s};n.log(r),n.R(r)}))}else this.L(this.h+" stopped.")},t.prototype.endPaint=function(t,i){var n=this;setTimeout((function(){n.end(t,i)}))},t.prototype.clear=function(t){this.v.clearMarks("mark_"+t+"_start"),this.v.clearMarks("mark_"+t+"_end"),delete this.o[t]},t.prototype.S=function(t){this.Z({A:t,q:"firstInputDelay",G:"duration"}),this.H(),this.J()},t.prototype.J=function(){this.K&&(clearTimeout(this.K),this.K=void 0,this.P("dataConsumption",this.m))},t.prototype.H=function(){this.u.U&&this.s&&(this.V(this.s,"largestContentfulPaint"),this.u.U.disconnect())},t.prototype.W=function(){this.u.X=this.Y("first-input",this.S.bind(this))},t.prototype.$=function(){var t=this;this.u.tt=this.Y("paint",(function(i){t.Z({A:i,it:"first-paint",q:"firstPaint",G:"startTime"}),t.Z({A:i,it:"first-contentful-paint",q:"firstContentfulPaint",G:"startTime"})}))},t.prototype.nt=function(){var t=this;this.u.U=this.Y("largest-contentful-paint",(function(i){var n=i.pop();n&&(t.s=n.renderTime||n.loadTime)}))},t.prototype._=function(){this.$(),this.W(),this.nt(),(this.config.resourceTiming||this.config.dataConsumption)&&this.st()},t.prototype.st=function(){var t=this;this.Y("resource",(function(i){t.et({A:i})})),this.K=setTimeout((function(){t.J()}),15e3)},t.prototype.D=function(){return!!(this.l.hardwareConcurrency&&this.l.hardwareConcurrency<=4)||(!!(this.l.deviceMemory&&this.l.deviceMemory<=4)||!!["slow-2g","2g","3g"].includes(this.p))},t.prototype.T=function(){return this.v&&!!this.v.getEntriesByType&&!!this.v.now&&!!this.v.mark},t.prototype.k=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.rt=function(t){var i=this.v.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},t.prototype.O=function(){return this.l?{deviceMemory:this.l.deviceMemory?this.l.deviceMemory:0,hardwareConcurrency:this.l.hardwareConcurrency?this.l.hardwareConcurrency:0}:{}},t.prototype.I=function(){if(!this.T())return{};var t=performance.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,n=t.responseEnd;return{fetchTime:n-t.fetchStart,workerTime:t.workerStart>0?n-t.workerStart:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}},t.prototype.C=function(){if("connection"in this.l){var t=this.l.connection;return"object"!=typeof t?{}:(this.p=t.effectiveType,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}},t.prototype.P=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var s=this.O();s.isLowEnd=this.D(),this.F((function(){n.log({q:t,data:i,B:s}),n.R({q:t,data:i,B:s})}))},t.prototype.V=function(t,i,n){var s=this;void 0===n&&(n="ms");var e=parseFloat(t.toFixed(2));if(!(e>this.config.maxMeasureTime||e<=0)){var r=this.O();r.isLowEnd=this.D(),this.F((function(){s.log({q:i,data:e+" "+n,B:r}),s.R({q:i,duration:e,B:r})}))}},t.prototype.log=function(t){if(!this.i&&this.config.logging){this.c.log("%c "+this.config.logPrefix+" "+t.q+" ","color:#ff6d00;font-size:11px;",t.data,t.B)}},t.prototype.L=function(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.N=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.g)},t.prototype.j=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.v.measure(t,i,n),this.rt(t)},t.prototype.Y=function(t,i){return this.at=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.at.observe({type:t,buffered:!0}),this.at},t.prototype.Z=function(t){var i=this;t.A.forEach((function(n){(!t.it||t.it&&n.name===t.it)&&i.V(n[t.G],t.q),i.u.tt&&"first-contentful-paint"===n.name&&i.u.tt.disconnect()})),this.u.X&&"firstInputDelay"===t.q&&this.u.X.disconnect()},t.prototype.et=function(t){var i=this;t.A.forEach((function(t){if(i.config.resourceTiming&&i.P("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType){var n=t.decodedBodySize/1e3;i.m[t.initiatorType]+=n,i.m.total+=n}}))},t.prototype.F=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.R=function(t){if(!this.i){var i=t.q,n=t.data,s=t.duration,e=t.M,r=t.B,a=e||{};this.config.analyticsTracker({metricName:i,data:n,duration:s,eventProperties:a,navigatorInformation:r})}},t}();module.exports=Perfume; | ||
"use strict";var Perfume=function(){function t(t){var i=this;if(void 0===t&&(t={}),this.config={dataConsumption:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},this.t="© 2020 Leonardo Zizzamia",this.version="4.7.4",this.c=window.console,this.d=document,this.i=!1,this.s=0,this.h="Recording already",this.o={},this.u={},this.m={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.w=window,this.v=window.performance,this.l=window.navigator,this.g="4g",this.p=!1,this.T=function(){i.d.hidden&&(i.i=i.d.hidden)},this.config=Object.assign({},this.config,t),this.k()){if(this._())try{this.N()}catch(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)}this.P(),this.I("navigationTiming",this.L()),this.I("networkInformation",this.j())}}return Object.defineProperty(t.prototype,"C",{get:function(){return!!(this.l.hardwareConcurrency&&this.l.hardwareConcurrency<=4)||!!(this.l.deviceMemory&&this.l.deviceMemory<=4)},O:!0,D:!0}),Object.defineProperty(t.prototype,"F",{get:function(){return!!this.C||(!!["slow-2g","2g","3g"].includes(this.g)||!!this.p)},O:!0,D:!0}),t.prototype.start=function(t){this.k()&&(this.o[t]?this.q(this.h+" started."):(this.o[t]=!0,this.v.mark("mark_"+t+"_start"),this.i=!1))},t.prototype.end=function(t,i){var n=this;if(void 0===i&&(i={}),this.k())if(this.o[t]){this.v.mark("mark_"+t+"_end");var s=this.M(t),e=parseFloat(s.toFixed(2));delete this.o[t],this.B((function(){var s=n.R();s.C=n.C,s.F=n.F;var r={S:t,data:e,duration:e,Z:i,A:s};n.log(r),n.G(r)}))}else this.q(this.h+" stopped.")},t.prototype.endPaint=function(t,i){var n=this;setTimeout((function(){n.end(t,i)}))},t.prototype.clear=function(t){this.v.clearMarks("mark_"+t+"_start"),this.v.clearMarks("mark_"+t+"_end"),delete this.o[t]},t.prototype.H=function(t){this.J({K:t,S:"firstInputDelay",U:"duration"}),this.V(),this.W()},t.prototype.W=function(){this.X&&(clearTimeout(this.X),this.X=void 0,this.I("dataConsumption",this.m))},t.prototype.V=function(){this.u.Y&&this.s&&(this.$(this.s,"largestContentfulPaint"),this.u.Y.disconnect())},t.prototype.tt=function(){this.u.it=this.nt("first-input",this.H.bind(this))},t.prototype.st=function(){var t=this;this.u.et=this.nt("paint",(function(i){t.J({K:i,rt:"first-paint",S:"firstPaint",U:"startTime"}),t.J({K:i,rt:"first-contentful-paint",S:"firstContentfulPaint",U:"startTime"})}))},t.prototype.at=function(){var t=this;this.u.Y=this.nt("largest-contentful-paint",(function(i){var n=i.pop();n&&(t.s=n.renderTime||n.loadTime)}))},t.prototype.N=function(){this.st(),this.tt(),this.at(),(this.config.resourceTiming||this.config.dataConsumption)&&this.ht()},t.prototype.ht=function(){var t=this;this.nt("resource",(function(i){t.ot({K:i})})),this.X=setTimeout((function(){t.W()}),15e3)},t.prototype.k=function(){return this.v&&!!this.v.getEntriesByType&&!!this.v.now&&!!this.v.mark},t.prototype._=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.ut=function(t){var i=this.v.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},t.prototype.R=function(){return this.l?{deviceMemory:this.l.deviceMemory?this.l.deviceMemory:0,hardwareConcurrency:this.l.hardwareConcurrency?this.l.hardwareConcurrency:0}:{}},t.prototype.L=function(){if(!this.k())return{};var t=performance.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,n=t.responseEnd;return{fetchTime:n-t.fetchStart,workerTime:t.workerStart>0?n-t.workerStart:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}},t.prototype.j=function(){if("connection"in this.l){var t=this.l.connection;return"object"!=typeof t?{}:(this.g=t.effectiveType,this.p=!!t.saveData,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}},t.prototype.I=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var s=this.R();s.C=this.C,s.F=this.F,this.B((function(){n.log({S:t,data:i,A:s}),n.G({S:t,data:i,A:s})}))},t.prototype.$=function(t,i,n){var s=this;void 0===n&&(n="ms");var e=parseFloat(t.toFixed(2));if(!(e>this.config.maxMeasureTime||e<=0)){var r=this.R();r.C=this.C,r.F=this.F,this.B((function(){s.log({S:i,data:e+" "+n,A:r}),s.G({S:i,duration:e,A:r})}))}},t.prototype.log=function(t){if(!this.i&&this.config.logging){this.c.log("%c "+this.config.logPrefix+" "+t.S+" ","color:#ff6d00;font-size:11px;",t.data,t.A)}},t.prototype.q=function(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.P=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.T)},t.prototype.M=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.v.measure(t,i,n),this.ut(t)},t.prototype.nt=function(t,i){return this.ft=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.ft.observe({type:t,buffered:!0}),this.ft},t.prototype.J=function(t){var i=this;t.K.forEach((function(n){(!t.rt||t.rt&&n.name===t.rt)&&i.$(n[t.U],t.S),i.u.et&&"first-contentful-paint"===n.name&&i.u.et.disconnect()})),this.u.it&&"firstInputDelay"===t.S&&this.u.it.disconnect()},t.prototype.ot=function(t){var i=this;t.K.forEach((function(t){if(i.config.resourceTiming&&i.I("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType){var n=t.decodedBodySize/1e3;i.m[t.initiatorType]+=n,i.m.total+=n}}))},t.prototype.B=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.G=function(t){if(!this.i){var i=t.S,n=t.data,s=t.duration,e=t.Z,r=t.A,a=e||{};this.config.analyticsTracker({metricName:i,data:n,duration:s,eventProperties:a,navigatorInformation:r})}},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).Perfume=i()}(this,(function(){"use strict";return function(){function t(t){var i=this;if(void 0===t&&(t={}),this.config={dataConsumption:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},this.t="© 2020 Leonardo Zizzamia",this.version="4.7.3",this.c=window.console,this.d=document,this.i=!1,this.s=0,this.o="Recording already",this.h={},this.u={},this.m={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.w=window,this.v=window.performance,this.l=window.navigator,this.p="4g",this.g=function(){i.d.hidden&&(i.i=i.d.hidden)},this.config=Object.assign({},this.config,t),this.T()){if(this.k())try{this._()}catch(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)}this.N(),this.I("navigationTiming",this.P()),this.I("networkInformation",this.C())}}return t.prototype.start=function(t){this.T()&&(this.h[t]?this.j(this.o+" started."):(this.h[t]=!0,this.v.mark("mark_"+t+"_start"),this.i=!1))},t.prototype.end=function(t,i){var n=this;if(void 0===i&&(i={}),this.T())if(this.h[t]){this.v.mark("mark_"+t+"_end");var s=this.L(t),e=parseFloat(s.toFixed(2));delete this.h[t],this.F((function(){var s=n.O();s.isLowEnd=n.D();var r={q:t,data:e,duration:e,M:i,B:s};n.log(r),n.R(r)}))}else this.j(this.o+" stopped.")},t.prototype.endPaint=function(t,i){var n=this;setTimeout((function(){n.end(t,i)}))},t.prototype.clear=function(t){this.v.clearMarks("mark_"+t+"_start"),this.v.clearMarks("mark_"+t+"_end"),delete this.h[t]},t.prototype.S=function(t){this.Z({A:t,q:"firstInputDelay",G:"duration"}),this.H(),this.J()},t.prototype.J=function(){this.K&&(clearTimeout(this.K),this.K=void 0,this.I("dataConsumption",this.m))},t.prototype.H=function(){this.u.U&&this.s&&(this.V(this.s,"largestContentfulPaint"),this.u.U.disconnect())},t.prototype.W=function(){this.u.X=this.Y("first-input",this.S.bind(this))},t.prototype.$=function(){var t=this;this.u.tt=this.Y("paint",(function(i){t.Z({A:i,it:"first-paint",q:"firstPaint",G:"startTime"}),t.Z({A:i,it:"first-contentful-paint",q:"firstContentfulPaint",G:"startTime"})}))},t.prototype.nt=function(){var t=this;this.u.U=this.Y("largest-contentful-paint",(function(i){var n=i.pop();n&&(t.s=n.renderTime||n.loadTime)}))},t.prototype._=function(){this.$(),this.W(),this.nt(),(this.config.resourceTiming||this.config.dataConsumption)&&this.st()},t.prototype.st=function(){var t=this;this.Y("resource",(function(i){t.et({A:i})})),this.K=setTimeout((function(){t.J()}),15e3)},t.prototype.D=function(){return!!(this.l.hardwareConcurrency&&this.l.hardwareConcurrency<=4)||(!!(this.l.deviceMemory&&this.l.deviceMemory<=4)||!!["slow-2g","2g","3g"].includes(this.p))},t.prototype.T=function(){return this.v&&!!this.v.getEntriesByType&&!!this.v.now&&!!this.v.mark},t.prototype.k=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.rt=function(t){var i=this.v.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},t.prototype.O=function(){return this.l?{deviceMemory:this.l.deviceMemory?this.l.deviceMemory:0,hardwareConcurrency:this.l.hardwareConcurrency?this.l.hardwareConcurrency:0}:{}},t.prototype.P=function(){if(!this.T())return{};var t=performance.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,n=t.responseEnd;return{fetchTime:n-t.fetchStart,workerTime:t.workerStart>0?n-t.workerStart:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}},t.prototype.C=function(){if("connection"in this.l){var t=this.l.connection;return"object"!=typeof t?{}:(this.p=t.effectiveType,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}},t.prototype.I=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var s=this.O();s.isLowEnd=this.D(),this.F((function(){n.log({q:t,data:i,B:s}),n.R({q:t,data:i,B:s})}))},t.prototype.V=function(t,i,n){var s=this;void 0===n&&(n="ms");var e=parseFloat(t.toFixed(2));if(!(e>this.config.maxMeasureTime||e<=0)){var r=this.O();r.isLowEnd=this.D(),this.F((function(){s.log({q:i,data:e+" "+n,B:r}),s.R({q:i,duration:e,B:r})}))}},t.prototype.log=function(t){if(!this.i&&this.config.logging){this.c.log("%c "+this.config.logPrefix+" "+t.q+" ","color:#ff6d00;font-size:11px;",t.data,t.B)}},t.prototype.j=function(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.N=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.g)},t.prototype.L=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.v.measure(t,i,n),this.rt(t)},t.prototype.Y=function(t,i){return this.ot=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.ot.observe({type:t,buffered:!0}),this.ot},t.prototype.Z=function(t){var i=this;t.A.forEach((function(n){(!t.it||t.it&&n.name===t.it)&&i.V(n[t.G],t.q),i.u.tt&&"first-contentful-paint"===n.name&&i.u.tt.disconnect()})),this.u.X&&"firstInputDelay"===t.q&&this.u.X.disconnect()},t.prototype.et=function(t){var i=this;t.A.forEach((function(t){if(i.config.resourceTiming&&i.I("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType){var n=t.decodedBodySize/1e3;i.m[t.initiatorType]+=n,i.m.total+=n}}))},t.prototype.F=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.R=function(t){if(!this.i){var i=t.q,n=t.data,s=t.duration,e=t.M,r=t.B,o=e||{};this.config.analyticsTracker({metricName:i,data:n,duration:s,eventProperties:o,navigatorInformation:r})}},t}()})); | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t=t||self).Perfume=i()}(this,(function(){"use strict";return function(){function t(t){var i=this;if(void 0===t&&(t={}),this.config={dataConsumption:!1,resourceTiming:!1,analyticsTracker:function(t){},logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3},this.t="© 2020 Leonardo Zizzamia",this.version="4.7.4",this.c=window.console,this.d=document,this.i=!1,this.s=0,this.o="Recording already",this.h={},this.u={},this.m={beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0},this.w=window,this.v=window.performance,this.l=window.navigator,this.p="4g",this.g=!1,this.T=function(){i.d.hidden&&(i.i=i.d.hidden)},this.config=Object.assign({},this.config,t),this.k()){if(this._())try{this.N()}catch(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)}this.I(),this.P("navigationTiming",this.j()),this.P("networkInformation",this.L())}}return Object.defineProperty(t.prototype,"C",{get:function(){return!!(this.l.hardwareConcurrency&&this.l.hardwareConcurrency<=4)||!!(this.l.deviceMemory&&this.l.deviceMemory<=4)},O:!0,D:!0}),Object.defineProperty(t.prototype,"F",{get:function(){return!!this.C||(!!["slow-2g","2g","3g"].includes(this.p)||!!this.g)},O:!0,D:!0}),t.prototype.start=function(t){this.k()&&(this.h[t]?this.q(this.o+" started."):(this.h[t]=!0,this.v.mark("mark_"+t+"_start"),this.i=!1))},t.prototype.end=function(t,i){var n=this;if(void 0===i&&(i={}),this.k())if(this.h[t]){this.v.mark("mark_"+t+"_end");var e=this.M(t),s=parseFloat(e.toFixed(2));delete this.h[t],this.B((function(){var e=n.R();e.C=n.C,e.F=n.F;var r={S:t,data:s,duration:s,Z:i,A:e};n.log(r),n.G(r)}))}else this.q(this.o+" stopped.")},t.prototype.endPaint=function(t,i){var n=this;setTimeout((function(){n.end(t,i)}))},t.prototype.clear=function(t){this.v.clearMarks("mark_"+t+"_start"),this.v.clearMarks("mark_"+t+"_end"),delete this.h[t]},t.prototype.H=function(t){this.J({K:t,S:"firstInputDelay",U:"duration"}),this.V(),this.W()},t.prototype.W=function(){this.X&&(clearTimeout(this.X),this.X=void 0,this.P("dataConsumption",this.m))},t.prototype.V=function(){this.u.Y&&this.s&&(this.$(this.s,"largestContentfulPaint"),this.u.Y.disconnect())},t.prototype.tt=function(){this.u.it=this.nt("first-input",this.H.bind(this))},t.prototype.et=function(){var t=this;this.u.st=this.nt("paint",(function(i){t.J({K:i,rt:"first-paint",S:"firstPaint",U:"startTime"}),t.J({K:i,rt:"first-contentful-paint",S:"firstContentfulPaint",U:"startTime"})}))},t.prototype.ot=function(){var t=this;this.u.Y=this.nt("largest-contentful-paint",(function(i){var n=i.pop();n&&(t.s=n.renderTime||n.loadTime)}))},t.prototype.N=function(){this.et(),this.tt(),this.ot(),(this.config.resourceTiming||this.config.dataConsumption)&&this.at()},t.prototype.at=function(){var t=this;this.nt("resource",(function(i){t.ht({K:i})})),this.X=setTimeout((function(){t.W()}),15e3)},t.prototype.k=function(){return this.v&&!!this.v.getEntriesByType&&!!this.v.now&&!!this.v.mark},t.prototype._=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.ut=function(t){var i=this.v.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},t.prototype.R=function(){return this.l?{deviceMemory:this.l.deviceMemory?this.l.deviceMemory:0,hardwareConcurrency:this.l.hardwareConcurrency?this.l.hardwareConcurrency:0}:{}},t.prototype.j=function(){if(!this.k())return{};var t=performance.getEntriesByType("navigation")[0];if(!t)return{};var i=t.responseStart,n=t.responseEnd;return{fetchTime:n-t.fetchStart,workerTime:t.workerStart>0?n-t.workerStart:0,totalTime:n-t.requestStart,downloadTime:n-i,timeToFirstByte:i-t.requestStart,headerSize:t.transferSize-t.encodedBodySize||0,dnsLookupTime:t.domainLookupEnd-t.domainLookupStart}},t.prototype.L=function(){if("connection"in this.l){var t=this.l.connection;return"object"!=typeof t?{}:(this.p=t.effectiveType,this.g=!!t.saveData,{downlink:t.downlink,effectiveType:t.effectiveType,rtt:t.rtt,saveData:!!t.saveData})}return{}},t.prototype.P=function(t,i){var n=this;Object.keys(i).forEach((function(t){"number"==typeof i[t]&&(i[t]=parseFloat(i[t].toFixed(2)))}));var e=this.R();e.C=this.C,e.F=this.F,this.B((function(){n.log({S:t,data:i,A:e}),n.G({S:t,data:i,A:e})}))},t.prototype.$=function(t,i,n){var e=this;void 0===n&&(n="ms");var s=parseFloat(t.toFixed(2));if(!(s>this.config.maxMeasureTime||s<=0)){var r=this.R();r.C=this.C,r.F=this.F,this.B((function(){e.log({S:i,data:s+" "+n,A:r}),e.G({S:i,duration:s,A:r})}))}},t.prototype.log=function(t){if(!this.i&&this.config.logging){this.c.log("%c "+this.config.logPrefix+" "+t.S+" ","color:#ff6d00;font-size:11px;",t.data,t.A)}},t.prototype.q=function(t){this.config.logging&&this.c.warn(this.config.logPrefix,t)},t.prototype.I=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.T)},t.prototype.M=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.v.measure(t,i,n),this.ut(t)},t.prototype.nt=function(t,i){return this.ft=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.ft.observe({type:t,buffered:!0}),this.ft},t.prototype.J=function(t){var i=this;t.K.forEach((function(n){(!t.rt||t.rt&&n.name===t.rt)&&i.$(n[t.U],t.S),i.u.st&&"first-contentful-paint"===n.name&&i.u.st.disconnect()})),this.u.it&&"firstInputDelay"===t.S&&this.u.it.disconnect()},t.prototype.ht=function(t){var i=this;t.K.forEach((function(t){if(i.config.resourceTiming&&i.P("resourceTiming",t),i.config.dataConsumption&&t.decodedBodySize&&t.initiatorType){var n=t.decodedBodySize/1e3;i.m[t.initiatorType]+=n,i.m.total+=n}}))},t.prototype.B=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.G=function(t){if(!this.i){var i=t.S,n=t.data,e=t.duration,s=t.Z,r=t.A,o=s||{};this.config.analyticsTracker({metricName:i,data:n,duration:e,eventProperties:o,navigatorInformation:r})}},t}()})); | ||
//# sourceMappingURL=perfume.umd.min.js.map |
/*! | ||
* Perfume.js v4.7.3 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v4.7.4 (http://zizzamia.github.io/perfume) | ||
* Copyright 2020 Leonardo Zizzamia (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
@@ -12,3 +12,3 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
eventProperties?: object; | ||
navigatorInformation?: object; | ||
navigatorInformation?: INavigatorInfo; | ||
} | ||
@@ -35,3 +35,3 @@ export interface IPerfumeConfig { | ||
customProperties?: object; | ||
navigatorInfo?: object; | ||
navigatorInfo?: INavigatorInfo; | ||
} | ||
@@ -44,3 +44,4 @@ export interface IMetricMap { | ||
hardwareConcurrency?: number; | ||
isLowEnd?: boolean; | ||
isLowEndDevice?: boolean; | ||
isLowEndExperience?: boolean; | ||
} | ||
@@ -125,2 +126,5 @@ export interface IPerfObservers { | ||
private et; | ||
private sd; | ||
get isLowEndDevice(): boolean; | ||
get isLowEndExperience(): boolean; | ||
constructor(options?: IPerfumeOptions); | ||
@@ -153,3 +157,2 @@ /** | ||
private initResourceTiming; | ||
private isAdaptiveLoading; | ||
/** | ||
@@ -156,0 +159,0 @@ * True if the browser supports the Navigation Timing API, |
{ | ||
"name": "perfume.js", | ||
"version": "4.7.3", | ||
"version": "4.7.4", | ||
"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.7.3](http://perfumejs.com) | ||
# [Perfume.js v4.7.4](http://perfumejs.com) | ||
@@ -73,3 +73,3 @@ [![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) | ||
analyticsTracker: (options) => { | ||
const { metricName, data, duration, isLowEnd } = options; | ||
const { metricName, data, duration, navigatorInformation } = options; | ||
switch (metricName) { | ||
@@ -411,3 +411,3 @@ case 'navigationTiming': | ||
} = options; | ||
myAnalyticsTool.track(data, duration, isLowEnd, metricName, navigatorInformation); | ||
myAnalyticsTool.track(data, duration, metricName, navigatorInformation); | ||
}) | ||
@@ -414,0 +414,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
352213
2133