perfume.js
Advanced tools
Comparing version 4.0.0-rc2 to 4.0.0-rc3
{ | ||
"name": "perfume.js/angular", | ||
"version": "4.0.0-rc2", | ||
"version": "4.0.0-rc3", | ||
"peerDependencies": { | ||
"@angular/common": "^6.0.0", | ||
"@angular/core": "^6.0.0", | ||
"perfume.js": "4.0.0-rc1" | ||
"perfume.js": "4.0.0-rc2" | ||
}, | ||
@@ -9,0 +9,0 @@ "main": "bundles/perfume.js-angular.umd.js", |
var Performance = /** @class */ (function () { | ||
function Performance() { | ||
this.navigationTimingCached = {}; | ||
this.w = window; | ||
this.wp = window.performance; | ||
} | ||
/** | ||
* True if the browser supports the Navigation Timing API, | ||
* User Timing API and the PerformanceObserver Interface. | ||
* In Safari, the User Timing API (performance.mark()) is not available, | ||
* so the DevTools timeline will not be annotated with marks. | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/mark | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType | ||
*/ | ||
Performance.supported = function () { | ||
return (window.performance && | ||
!!performance.getEntriesByType && | ||
!!performance.now && | ||
!!performance.mark); | ||
}; | ||
/** | ||
* For now only Chrome fully support the PerformanceObserver interface | ||
* and the entryType "paint". | ||
* Firefox 58: https://bugzilla.mozilla.org/show_bug.cgi?id=1403027 | ||
*/ | ||
Performance.supportedPerformanceObserver = function () { | ||
return window.chrome && 'PerformanceObserver' in window; | ||
}; | ||
Object.defineProperty(Performance.prototype, "navigationTiming", { | ||
@@ -35,4 +14,3 @@ /** | ||
get: function () { | ||
if (!Performance.supported() || | ||
Object.keys(this.navigationTimingCached).length) { | ||
if (!this.isSupported || Object.keys(this.navigationTimingCached).length) { | ||
return this.navigationTimingCached; | ||
@@ -70,2 +48,30 @@ } | ||
}); | ||
Object.defineProperty(Performance.prototype, "isSupported", { | ||
/** | ||
* True if the browser supports the Navigation Timing API, | ||
* User Timing API and the PerformanceObserver Interface. | ||
* In Safari, the User Timing API (performance.mark()) is not available, | ||
* so the DevTools timeline will not be annotated with marks. | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/mark | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType | ||
*/ | ||
get: function () { | ||
return (this.wp && !!this.wp.getEntriesByType && !!this.wp.now && !!this.wp.mark); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Performance.prototype, "isSupportedPerformanceObserver", { | ||
/** | ||
* For now only Chrome fully support the PerformanceObserver interface | ||
* and the entryType "paint". | ||
* Firefox 58: https://bugzilla.mozilla.org/show_bug.cgi?id=1403027 | ||
*/ | ||
get: function () { | ||
return this.w.chrome && 'PerformanceObserver' in this.w; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -72,0 +78,0 @@ * When performance API available |
@@ -13,3 +13,3 @@ var __assign = (this && this.__assign) || function () { | ||
/*! | ||
* Perfume.js v4.0.0-rc2 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v4.0.0-rc3 (http://zizzamia.github.io/perfume) | ||
* Copyright 2018 The Perfume Authors (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
@@ -20,2 +20,4 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
import Performance from './performance'; | ||
var w = window; | ||
var c = window.console; | ||
var Perfume = /** @class */ (function () { | ||
@@ -59,7 +61,7 @@ function Perfume(options) { | ||
// Exit from Perfume when basic Web Performance APIs aren't supported | ||
if (!Performance.supported()) { | ||
if (!this.perf.isSupported) { | ||
return; | ||
} | ||
// Checks if use Performance or the EmulatedPerformance instance | ||
if (Performance.supportedPerformanceObserver()) { | ||
if (this.perf.isSupportedPerformanceObserver) { | ||
this.initPerformanceObserver(); | ||
@@ -88,3 +90,3 @@ } | ||
Perfume.prototype.start = function (metricName) { | ||
if (!this.checkMetricName(metricName) || !Performance.supported()) { | ||
if (!this.checkMetricName(metricName) || !this.perf.isSupported) { | ||
return; | ||
@@ -110,3 +112,3 @@ } | ||
var _this = this; | ||
if (!this.checkMetricName(metricName) || !Performance.supported()) { | ||
if (!this.checkMetricName(metricName) || !this.perf.isSupported) { | ||
return; | ||
@@ -145,12 +147,2 @@ } | ||
}; | ||
/** | ||
* Coloring Debugging Text in Browser Console | ||
*/ | ||
Perfume.prototype.logDebug = function (methodName, debugValue) { | ||
if (debugValue === void 0) { debugValue = ''; } | ||
if (!this.config.debugging) { | ||
return; | ||
} | ||
window.console.log(this.config.logPrefix + " debugging " + methodName + ":", debugValue); | ||
}; | ||
Perfume.prototype.initPerformanceObserver = function () { | ||
@@ -177,2 +169,12 @@ if (this.config.firstPaint || this.config.firstContentfulPaint) { | ||
/** | ||
* Coloring Debugging Text in Browser Console | ||
*/ | ||
Perfume.prototype.logDebug = function (methodName, debugValue) { | ||
if (debugValue === void 0) { debugValue = ''; } | ||
if (!this.config.debugging) { | ||
return; | ||
} | ||
c.log(this.config.logPrefix + " debugging " + methodName + ":", debugValue); | ||
}; | ||
/** | ||
* Logging Performance Paint Timing | ||
@@ -334,6 +336,6 @@ */ | ||
text += durationMs + " " + suffix; | ||
window.console.log(text, style); | ||
c.log(text, style); | ||
} | ||
else if (data) { | ||
window.console.log(text, style, data); | ||
c.log(text, style, data); | ||
} | ||
@@ -377,3 +379,3 @@ }; | ||
} | ||
window.console.warn(this.config.logPrefix, message); | ||
c.warn(this.config.logPrefix, message); | ||
}; | ||
@@ -384,4 +386,4 @@ /** | ||
Perfume.prototype.pushTask = function (cb) { | ||
if ('requestIdleCallback' in window) { | ||
window.requestIdleCallback(cb, { timeout: 3000 }); | ||
if ('requestIdleCallback' in w) { | ||
w.requestIdleCallback(cb, { timeout: 3000 }); | ||
} | ||
@@ -388,0 +390,0 @@ else { |
@@ -6,26 +6,5 @@ "use strict"; | ||
this.navigationTimingCached = {}; | ||
this.w = window; | ||
this.wp = window.performance; | ||
} | ||
/** | ||
* True if the browser supports the Navigation Timing API, | ||
* User Timing API and the PerformanceObserver Interface. | ||
* In Safari, the User Timing API (performance.mark()) is not available, | ||
* so the DevTools timeline will not be annotated with marks. | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/mark | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType | ||
*/ | ||
Performance.supported = function () { | ||
return (window.performance && | ||
!!performance.getEntriesByType && | ||
!!performance.now && | ||
!!performance.mark); | ||
}; | ||
/** | ||
* For now only Chrome fully support the PerformanceObserver interface | ||
* and the entryType "paint". | ||
* Firefox 58: https://bugzilla.mozilla.org/show_bug.cgi?id=1403027 | ||
*/ | ||
Performance.supportedPerformanceObserver = function () { | ||
return window.chrome && 'PerformanceObserver' in window; | ||
}; | ||
Object.defineProperty(Performance.prototype, "navigationTiming", { | ||
@@ -38,4 +17,3 @@ /** | ||
get: function () { | ||
if (!Performance.supported() || | ||
Object.keys(this.navigationTimingCached).length) { | ||
if (!this.isSupported || Object.keys(this.navigationTimingCached).length) { | ||
return this.navigationTimingCached; | ||
@@ -73,2 +51,30 @@ } | ||
}); | ||
Object.defineProperty(Performance.prototype, "isSupported", { | ||
/** | ||
* True if the browser supports the Navigation Timing API, | ||
* User Timing API and the PerformanceObserver Interface. | ||
* In Safari, the User Timing API (performance.mark()) is not available, | ||
* so the DevTools timeline will not be annotated with marks. | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/mark | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/PerformanceObserver | ||
* Support: developer.mozilla.org/en-US/docs/Web/API/Performance/getEntriesByType | ||
*/ | ||
get: function () { | ||
return (this.wp && !!this.wp.getEntriesByType && !!this.wp.now && !!this.wp.mark); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(Performance.prototype, "isSupportedPerformanceObserver", { | ||
/** | ||
* For now only Chrome fully support the PerformanceObserver interface | ||
* and the entryType "paint". | ||
* Firefox 58: https://bugzilla.mozilla.org/show_bug.cgi?id=1403027 | ||
*/ | ||
get: function () { | ||
return this.w.chrome && 'PerformanceObserver' in this.w; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -75,0 +81,0 @@ * When performance API available |
@@ -15,3 +15,3 @@ "use strict"; | ||
/*! | ||
* Perfume.js v4.0.0-rc2 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v4.0.0-rc3 (http://zizzamia.github.io/perfume) | ||
* Copyright 2018 The Perfume Authors (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
@@ -22,2 +22,4 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
var performance_1 = require("./performance"); | ||
var w = window; | ||
var c = window.console; | ||
var Perfume = /** @class */ (function () { | ||
@@ -61,7 +63,7 @@ function Perfume(options) { | ||
// Exit from Perfume when basic Web Performance APIs aren't supported | ||
if (!performance_1.default.supported()) { | ||
if (!this.perf.isSupported) { | ||
return; | ||
} | ||
// Checks if use Performance or the EmulatedPerformance instance | ||
if (performance_1.default.supportedPerformanceObserver()) { | ||
if (this.perf.isSupportedPerformanceObserver) { | ||
this.initPerformanceObserver(); | ||
@@ -90,3 +92,3 @@ } | ||
Perfume.prototype.start = function (metricName) { | ||
if (!this.checkMetricName(metricName) || !performance_1.default.supported()) { | ||
if (!this.checkMetricName(metricName) || !this.perf.isSupported) { | ||
return; | ||
@@ -112,3 +114,3 @@ } | ||
var _this = this; | ||
if (!this.checkMetricName(metricName) || !performance_1.default.supported()) { | ||
if (!this.checkMetricName(metricName) || !this.perf.isSupported) { | ||
return; | ||
@@ -147,12 +149,2 @@ } | ||
}; | ||
/** | ||
* Coloring Debugging Text in Browser Console | ||
*/ | ||
Perfume.prototype.logDebug = function (methodName, debugValue) { | ||
if (debugValue === void 0) { debugValue = ''; } | ||
if (!this.config.debugging) { | ||
return; | ||
} | ||
window.console.log(this.config.logPrefix + " debugging " + methodName + ":", debugValue); | ||
}; | ||
Perfume.prototype.initPerformanceObserver = function () { | ||
@@ -179,2 +171,12 @@ if (this.config.firstPaint || this.config.firstContentfulPaint) { | ||
/** | ||
* Coloring Debugging Text in Browser Console | ||
*/ | ||
Perfume.prototype.logDebug = function (methodName, debugValue) { | ||
if (debugValue === void 0) { debugValue = ''; } | ||
if (!this.config.debugging) { | ||
return; | ||
} | ||
c.log(this.config.logPrefix + " debugging " + methodName + ":", debugValue); | ||
}; | ||
/** | ||
* Logging Performance Paint Timing | ||
@@ -336,6 +338,6 @@ */ | ||
text += durationMs + " " + suffix; | ||
window.console.log(text, style); | ||
c.log(text, style); | ||
} | ||
else if (data) { | ||
window.console.log(text, style, data); | ||
c.log(text, style, data); | ||
} | ||
@@ -379,3 +381,3 @@ }; | ||
} | ||
window.console.warn(this.config.logPrefix, message); | ||
c.warn(this.config.logPrefix, message); | ||
}; | ||
@@ -386,4 +388,4 @@ /** | ||
Perfume.prototype.pushTask = function (cb) { | ||
if ('requestIdleCallback' in window) { | ||
window.requestIdleCallback(cb, { timeout: 3000 }); | ||
if ('requestIdleCallback' in w) { | ||
w.requestIdleCallback(cb, { timeout: 3000 }); | ||
} | ||
@@ -390,0 +392,0 @@ else { |
@@ -1,2 +0,2 @@ | ||
var t=function(){function t(){this.t={}}return t.i=function(){return window.performance&&!!performance.getEntriesByType&&!!performance.now&&!!performance.mark},t.s=function(){return window.chrome&&"PerformanceObserver"in window},Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!t.i()||Object.keys(this.t).length)return this.t;var i=performance.getEntriesByType("navigation")[0];return i?(this.t={fetchTime:parseFloat((i.responseEnd-i.fetchStart).toFixed(2)),workerTime:parseFloat((i.o>0?i.responseEnd-i.o:0).toFixed(2)),totalTime:parseFloat((i.responseEnd-i.requestStart).toFixed(2)),downloadTime:parseFloat((i.responseEnd-i.responseStart).toFixed(2)),timeToFirstByte:parseFloat((i.responseStart-i.requestStart).toFixed(2)),headerSize:parseFloat((i.h-i.u).toFixed(2)),dnsLookupTime:parseFloat((i.domainLookupEnd-i.domainLookupStart).toFixed(2))},this.t):this.t},m:!0,l:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,i){var n="mark_"+t+"_"+i;window.performance.mark(n)},t.prototype.measure=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.v(t)},t.prototype.g=function(t,i){return this.p=new PerformanceObserver(this.P.bind(this,i)),this.p.observe({type:t,buffered:!0}),this.p},t.prototype.v=function(t){var i=this.T(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.T=function(t){var i=window.performance.getEntriesByName(t);return i[i.length-1]},t.prototype.P=function(t,i){t(i.getEntries())},t}(),i=function(){return(i=Object.assign||function(t){for(var i,n=1,e=arguments.length;n<e;n++)for(var s in i=arguments[n])Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s]);return t}).apply(this,arguments)},n=function(){function n(i){var n=this;void 0===i&&(i={}),this.config={C:!1,F:!1,N:!1,L:!1,D:!1,navigationTiming:!1,O:function(t){},j:"Perfume.js:",k:!0,I:15e3,_:2e4,q:!1,B:!1},this.L=0,this.K=!1,this.M=0,this.R="Please provide a metric name",this.S="Recording already",this.A={},this.G={},this.H=function(){document.hidden&&(n.K=document.hidden)},this.config=Object.assign({},this.config,i),this.J=new t,t.i()&&(t.s()&&this.U(),this.V(),this.config.navigationTiming&&this.W())}return Object.defineProperty(n.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.J.navigationTiming:{}},m:!0,l:!0}),n.prototype.start=function(i){this.X(i)&&t.i()&&(this.A[i]?this.Y(this.S+" started."):(this.A[i]={end:0,start:this.J.now()},this.J.mark(i,"start"),this.K=!1))},n.prototype.end=function(i){var n=this;if(this.X(i)&&t.i()){var e=this.A[i];if(e){e.end=this.J.now(),this.J.mark(i,"end");var s=this.J.measure(i),r=parseFloat(s.toFixed(2));return delete this.A[i],this.Z((function(){n.log({$:i,duration:r}),n.sendTiming({$:i,duration:r})})),r}this.Y(this.S+" stopped.")}},n.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var e=i.end(t);n(e)}))}))},n.prototype.logDebug=function(t,i){void 0===i&&(i=""),this.config.B&&window.console.log(this.config.j+" debugging "+t+":",i)},n.prototype.U=function(){(this.config.F||this.config.C)&&this.tt(),this.it(),this.nt(),this.config.L&&this.et()},n.prototype.X=function(t){return!!t||(this.Y(this.R),!1)},n.prototype.P=function(t){var i=this;this.logDebug("PerformanceEntry",t),t.entries.forEach((function(n){i.Z((function(){i.config[t.$]&&(!t.st||t.st&&n.name===t.st)&&i.rt(n[t.at],t.ot,t.$)})),i.G.C&&"first-contentful-paint"===n.name&&i.G.C.disconnect()})),this.G.N&&"firstInputDelay"===t.$&&this.G.N.disconnect()},n.prototype.ht=function(t){var i=this;this.logDebug("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.ut){var n=parseFloat((t.ut/1e3).toFixed(2));i.L+=n}}))},n.prototype.ft=function(t){this.P({entries:t,st:"first-paint",ot:"First Paint",$:"firstPaint",at:"startTime"}),this.P({entries:t,st:"first-contentful-paint",ot:"First Contentful Paint",$:"firstContentfulPaint",at:"startTime"})},n.prototype.tt=function(){try{this.G.C=this.J.g("paint",this.ft.bind(this))}catch(t){this.Y("FP:failed")}},n.prototype.ct=function(t){this.P({entries:t,ot:"First Input Delay",$:"firstInputDelay",at:"duration"}),this.config.D&&this.M&&this.rt(this.M,"Largest Contentful Paint","largestContentfulPaint"),this.dt()},n.prototype.lt=function(t){this.logDebug("PerformanceEntry:LCP",t);var i=t[t.length-1];this.M=i.vt||i.gt},n.prototype.it=function(){try{this.G.N=this.J.g("first-input",this.ct.bind(this))}catch(t){this.Y("FID:failed")}},n.prototype.nt=function(){try{this.G.D=this.J.g("largest-contentful-paint",this.lt.bind(this))}catch(t){this.Y("LCP:failed")}},n.prototype.pt=function(t){this.ht({entries:t})},n.prototype.dt=function(){clearTimeout(this.wt),this.G.L&&this.L&&(this.rt(this.L,"Data Consumption","dataConsumption","Kb"),this.G.L.disconnect())},n.prototype.et=function(){var t=this;try{this.G.L=this.J.g("resource",this.pt.bind(this))}catch(t){this.Y("DataConsumption:failed")}this.wt=setTimeout((function(){t.dt()}),15e3)},n.prototype.V=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.H)},n.prototype.log=function(t){var n=i({suffix:"ms"},t),e=n.$,s=n.data,r=n.duration,a=n.suffix;if(!this.K&&this.config.k)if(e){var o="color: #ff6d00;font-size:11px;",h="%c "+this.config.j+" "+e+" ";if(r)h+=r.toFixed(2)+" "+a,window.console.log(h,o);else s&&window.console.log(h,o,s)}else this.Y(this.R)},n.prototype.rt=function(t,i,n,e){void 0===e&&(e="ms");var s=parseFloat(t.toFixed(2));"dataConsumption"!==n&&s>this.config.I||"dataConsumption"===n&&s>this.config._||(this.log({$:i,duration:s,suffix:e}),this.sendTiming({$:n,duration:s}))},n.prototype.W=function(){this.log({$:"navigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({$:"navigationTiming",data:this.navigationTiming})},n.prototype.Y=function(t){this.config.q&&this.config.k&&window.console.warn(this.config.j,t)},n.prototype.Z=function(t){"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:3e3}):t()},n.prototype.sendTiming=function(t){var i=t.$,n=t.data,e=t.duration;this.K||this.config.O({$:i,data:n,duration:e})},n}();export default n; | ||
var t=function(){function t(){this.t={},this.w=window,this.i=window.performance}return Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!this.isSupported||Object.keys(this.t).length)return this.t;var t=performance.getEntriesByType("navigation")[0];return t?(this.t={fetchTime:parseFloat((t.responseEnd-t.fetchStart).toFixed(2)),workerTime:parseFloat((t.s>0?t.responseEnd-t.s:0).toFixed(2)),totalTime:parseFloat((t.responseEnd-t.requestStart).toFixed(2)),downloadTime:parseFloat((t.responseEnd-t.responseStart).toFixed(2)),timeToFirstByte:parseFloat((t.responseStart-t.requestStart).toFixed(2)),headerSize:parseFloat((t.o-t.h).toFixed(2)),dnsLookupTime:parseFloat((t.domainLookupEnd-t.domainLookupStart).toFixed(2))},this.t):this.t},u:!0,m:!0}),Object.defineProperty(t.prototype,"isSupported",{get:function(){return this.i&&!!this.i.getEntriesByType&&!!this.i.now&&!!this.i.mark},u:!0,m:!0}),Object.defineProperty(t.prototype,"l",{get:function(){return this.w.chrome&&"PerformanceObserver"in this.w},u:!0,m:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,i){var n="mark_"+t+"_"+i;window.performance.mark(n)},t.prototype.measure=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.g(t)},t.prototype.v=function(t,i){return this.p=new PerformanceObserver(this.P.bind(this,i)),this.p.observe({type:t,buffered:!0}),this.p},t.prototype.g=function(t){var i=this.T(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.T=function(t){var i=window.performance.getEntriesByName(t);return i[i.length-1]},t.prototype.P=function(t,i){t(i.getEntries())},t}(),i=function(){return(i=Object.assign||function(t){for(var i,n=1,e=arguments.length;n<e;n++)for(var s in i=arguments[n])Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s]);return t}).apply(this,arguments)},n=window,e=window.console,s=function(){function s(i){var n=this;void 0===i&&(i={}),this.config={C:!1,F:!1,N:!1,O:!1,L:!1,navigationTiming:!1,j:function(t){},D:"Perfume.js:",k:!0,I:15e3,_:2e4,S:!1,q:!1},this.O=0,this.B=!1,this.K=0,this.M="Please provide a metric name",this.R="Recording already",this.A={},this.G={},this.H=function(){document.hidden&&(n.B=document.hidden)},this.config=Object.assign({},this.config,i),this.J=new t,this.J.isSupported&&(this.J.l&&this.U(),this.V(),this.config.navigationTiming&&this.W())}return Object.defineProperty(s.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.J.navigationTiming:{}},u:!0,m:!0}),s.prototype.start=function(t){this.X(t)&&this.J.isSupported&&(this.A[t]?this.Y(this.R+" started."):(this.A[t]={end:0,start:this.J.now()},this.J.mark(t,"start"),this.B=!1))},s.prototype.end=function(t){var i=this;if(this.X(t)&&this.J.isSupported){var n=this.A[t];if(n){n.end=this.J.now(),this.J.mark(t,"end");var e=this.J.measure(t),s=parseFloat(e.toFixed(2));return delete this.A[t],this.Z((function(){i.log({$:t,duration:s}),i.sendTiming({$:t,duration:s})})),s}this.Y(this.R+" stopped.")}},s.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var e=i.end(t);n(e)}))}))},s.prototype.U=function(){(this.config.F||this.config.C)&&this.tt(),this.it(),this.nt(),this.config.O&&this.et()},s.prototype.X=function(t){return!!t||(this.Y(this.M),!1)},s.prototype.st=function(t,i){void 0===i&&(i=""),this.config.q&&e.log(this.config.D+" debugging "+t+":",i)},s.prototype.P=function(t){var i=this;this.st("PerformanceEntry",t),t.entries.forEach((function(n){i.Z((function(){i.config[t.$]&&(!t.rt||t.rt&&n.name===t.rt)&&i.at(n[t.ot],t.ht,t.$)})),i.G.C&&"first-contentful-paint"===n.name&&i.G.C.disconnect()})),this.G.N&&"firstInputDelay"===t.$&&this.G.N.disconnect()},s.prototype.ut=function(t){var i=this;this.st("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.ct){var n=parseFloat((t.ct/1e3).toFixed(2));i.O+=n}}))},s.prototype.ft=function(t){this.P({entries:t,rt:"first-paint",ht:"First Paint",$:"firstPaint",ot:"startTime"}),this.P({entries:t,rt:"first-contentful-paint",ht:"First Contentful Paint",$:"firstContentfulPaint",ot:"startTime"})},s.prototype.tt=function(){try{this.G.C=this.J.v("paint",this.ft.bind(this))}catch(t){this.Y("FP:failed")}},s.prototype.lt=function(t){this.P({entries:t,ht:"First Input Delay",$:"firstInputDelay",ot:"duration"}),this.config.L&&this.K&&this.at(this.K,"Largest Contentful Paint","largestContentfulPaint"),this.dt()},s.prototype.gt=function(t){this.st("PerformanceEntry:LCP",t);var i=t[t.length-1];this.K=i.vt||i.pt},s.prototype.it=function(){try{this.G.N=this.J.v("first-input",this.lt.bind(this))}catch(t){this.Y("FID:failed")}},s.prototype.nt=function(){try{this.G.L=this.J.v("largest-contentful-paint",this.gt.bind(this))}catch(t){this.Y("LCP:failed")}},s.prototype.bt=function(t){this.ut({entries:t})},s.prototype.dt=function(){clearTimeout(this.wt),this.G.O&&this.O&&(this.at(this.O,"Data Consumption","dataConsumption","Kb"),this.G.O.disconnect())},s.prototype.et=function(){var t=this;try{this.G.O=this.J.v("resource",this.bt.bind(this))}catch(t){this.Y("DataConsumption:failed")}this.wt=setTimeout((function(){t.dt()}),15e3)},s.prototype.V=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.H)},s.prototype.log=function(t){var n=i({suffix:"ms"},t),s=n.$,r=n.data,a=n.duration,o=n.suffix;if(!this.B&&this.config.k)if(s){var h="color: #ff6d00;font-size:11px;",u="%c "+this.config.D+" "+s+" ";if(a)u+=a.toFixed(2)+" "+o,e.log(u,h);else r&&e.log(u,h,r)}else this.Y(this.M)},s.prototype.at=function(t,i,n,e){void 0===e&&(e="ms");var s=parseFloat(t.toFixed(2));"dataConsumption"!==n&&s>this.config.I||"dataConsumption"===n&&s>this.config._||(this.log({$:i,duration:s,suffix:e}),this.sendTiming({$:n,duration:s}))},s.prototype.W=function(){this.log({$:"navigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({$:"navigationTiming",data:this.navigationTiming})},s.prototype.Y=function(t){this.config.S&&this.config.k&&e.warn(this.config.D,t)},s.prototype.Z=function(t){"requestIdleCallback"in n?n.Pt(t,{timeout:3e3}):t()},s.prototype.sendTiming=function(t){var i=t.$,n=t.data,e=t.duration;this.B||this.config.j({$:i,data:n,duration:e})},s}();export default s; | ||
//# sourceMappingURL=perfume.esm.min.js.map |
@@ -1,2 +0,2 @@ | ||
var Perfume=function(){"use strict";var t=function(){function t(){this.t={}}return t.i=function(){return window.performance&&!!performance.getEntriesByType&&!!performance.now&&!!performance.mark},t.s=function(){return window.chrome&&"PerformanceObserver"in window},Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!t.i()||Object.keys(this.t).length)return this.t;var i=performance.getEntriesByType("navigation")[0];return i?(this.t={fetchTime:parseFloat((i.responseEnd-i.fetchStart).toFixed(2)),workerTime:parseFloat((i.o>0?i.responseEnd-i.o:0).toFixed(2)),totalTime:parseFloat((i.responseEnd-i.requestStart).toFixed(2)),downloadTime:parseFloat((i.responseEnd-i.responseStart).toFixed(2)),timeToFirstByte:parseFloat((i.responseStart-i.requestStart).toFixed(2)),headerSize:parseFloat((i.h-i.u).toFixed(2)),dnsLookupTime:parseFloat((i.domainLookupEnd-i.domainLookupStart).toFixed(2))},this.t):this.t},m:!0,l:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,i){var n="mark_"+t+"_"+i;window.performance.mark(n)},t.prototype.measure=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.v(t)},t.prototype.g=function(t,i){return this.p=new PerformanceObserver(this.P.bind(this,i)),this.p.observe({type:t,buffered:!0}),this.p},t.prototype.v=function(t){var i=this.T(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.T=function(t){var i=window.performance.getEntriesByName(t);return i[i.length-1]},t.prototype.P=function(t,i){t(i.getEntries())},t}(),i=function(){return(i=Object.assign||function(t){for(var i,n=1,e=arguments.length;n<e;n++)for(var s in i=arguments[n])Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s]);return t}).apply(this,arguments)};return function(){function n(i){var n=this;void 0===i&&(i={}),this.config={C:!1,F:!1,N:!1,L:!1,D:!1,navigationTiming:!1,O:function(t){},j:"Perfume.js:",k:!0,I:15e3,_:2e4,q:!1,B:!1},this.L=0,this.K=!1,this.M=0,this.R="Please provide a metric name",this.S="Recording already",this.A={},this.G={},this.H=function(){document.hidden&&(n.K=document.hidden)},this.config=Object.assign({},this.config,i),this.J=new t,t.i()&&(t.s()&&this.U(),this.V(),this.config.navigationTiming&&this.W())}return Object.defineProperty(n.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.J.navigationTiming:{}},m:!0,l:!0}),n.prototype.start=function(i){this.X(i)&&t.i()&&(this.A[i]?this.Y(this.S+" started."):(this.A[i]={end:0,start:this.J.now()},this.J.mark(i,"start"),this.K=!1))},n.prototype.end=function(i){var n=this;if(this.X(i)&&t.i()){var e=this.A[i];if(e){e.end=this.J.now(),this.J.mark(i,"end");var s=this.J.measure(i),r=parseFloat(s.toFixed(2));return delete this.A[i],this.Z((function(){n.log({$:i,duration:r}),n.sendTiming({$:i,duration:r})})),r}this.Y(this.S+" stopped.")}},n.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var e=i.end(t);n(e)}))}))},n.prototype.logDebug=function(t,i){void 0===i&&(i=""),this.config.B&&window.console.log(this.config.j+" debugging "+t+":",i)},n.prototype.U=function(){(this.config.F||this.config.C)&&this.tt(),this.it(),this.nt(),this.config.L&&this.et()},n.prototype.X=function(t){return!!t||(this.Y(this.R),!1)},n.prototype.P=function(t){var i=this;this.logDebug("PerformanceEntry",t),t.entries.forEach((function(n){i.Z((function(){i.config[t.$]&&(!t.st||t.st&&n.name===t.st)&&i.rt(n[t.at],t.ot,t.$)})),i.G.C&&"first-contentful-paint"===n.name&&i.G.C.disconnect()})),this.G.N&&"firstInputDelay"===t.$&&this.G.N.disconnect()},n.prototype.ht=function(t){var i=this;this.logDebug("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.ut){var n=parseFloat((t.ut/1e3).toFixed(2));i.L+=n}}))},n.prototype.ft=function(t){this.P({entries:t,st:"first-paint",ot:"First Paint",$:"firstPaint",at:"startTime"}),this.P({entries:t,st:"first-contentful-paint",ot:"First Contentful Paint",$:"firstContentfulPaint",at:"startTime"})},n.prototype.tt=function(){try{this.G.C=this.J.g("paint",this.ft.bind(this))}catch(t){this.Y("FP:failed")}},n.prototype.ct=function(t){this.P({entries:t,ot:"First Input Delay",$:"firstInputDelay",at:"duration"}),this.config.D&&this.M&&this.rt(this.M,"Largest Contentful Paint","largestContentfulPaint"),this.dt()},n.prototype.lt=function(t){this.logDebug("PerformanceEntry:LCP",t);var i=t[t.length-1];this.M=i.vt||i.gt},n.prototype.it=function(){try{this.G.N=this.J.g("first-input",this.ct.bind(this))}catch(t){this.Y("FID:failed")}},n.prototype.nt=function(){try{this.G.D=this.J.g("largest-contentful-paint",this.lt.bind(this))}catch(t){this.Y("LCP:failed")}},n.prototype.pt=function(t){this.ht({entries:t})},n.prototype.dt=function(){clearTimeout(this.wt),this.G.L&&this.L&&(this.rt(this.L,"Data Consumption","dataConsumption","Kb"),this.G.L.disconnect())},n.prototype.et=function(){var t=this;try{this.G.L=this.J.g("resource",this.pt.bind(this))}catch(t){this.Y("DataConsumption:failed")}this.wt=setTimeout((function(){t.dt()}),15e3)},n.prototype.V=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.H)},n.prototype.log=function(t){var n=i({suffix:"ms"},t),e=n.$,s=n.data,r=n.duration,a=n.suffix;if(!this.K&&this.config.k)if(e){var o="color: #ff6d00;font-size:11px;",h="%c "+this.config.j+" "+e+" ";if(r)h+=r.toFixed(2)+" "+a,window.console.log(h,o);else s&&window.console.log(h,o,s)}else this.Y(this.R)},n.prototype.rt=function(t,i,n,e){void 0===e&&(e="ms");var s=parseFloat(t.toFixed(2));"dataConsumption"!==n&&s>this.config.I||"dataConsumption"===n&&s>this.config._||(this.log({$:i,duration:s,suffix:e}),this.sendTiming({$:n,duration:s}))},n.prototype.W=function(){this.log({$:"navigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({$:"navigationTiming",data:this.navigationTiming})},n.prototype.Y=function(t){this.config.q&&this.config.k&&window.console.warn(this.config.j,t)},n.prototype.Z=function(t){"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:3e3}):t()},n.prototype.sendTiming=function(t){var i=t.$,n=t.data,e=t.duration;this.K||this.config.O({$:i,data:n,duration:e})},n}()}(); | ||
var Perfume=function(){"use strict";var t=function(){function t(){this.t={},this.w=window,this.i=window.performance}return Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!this.isSupported||Object.keys(this.t).length)return this.t;var t=performance.getEntriesByType("navigation")[0];return t?(this.t={fetchTime:parseFloat((t.responseEnd-t.fetchStart).toFixed(2)),workerTime:parseFloat((t.s>0?t.responseEnd-t.s:0).toFixed(2)),totalTime:parseFloat((t.responseEnd-t.requestStart).toFixed(2)),downloadTime:parseFloat((t.responseEnd-t.responseStart).toFixed(2)),timeToFirstByte:parseFloat((t.responseStart-t.requestStart).toFixed(2)),headerSize:parseFloat((t.o-t.h).toFixed(2)),dnsLookupTime:parseFloat((t.domainLookupEnd-t.domainLookupStart).toFixed(2))},this.t):this.t},u:!0,m:!0}),Object.defineProperty(t.prototype,"isSupported",{get:function(){return this.i&&!!this.i.getEntriesByType&&!!this.i.now&&!!this.i.mark},u:!0,m:!0}),Object.defineProperty(t.prototype,"l",{get:function(){return this.w.chrome&&"PerformanceObserver"in this.w},u:!0,m:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,i){var n="mark_"+t+"_"+i;window.performance.mark(n)},t.prototype.measure=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.g(t)},t.prototype.v=function(t,i){return this.p=new PerformanceObserver(this.P.bind(this,i)),this.p.observe({type:t,buffered:!0}),this.p},t.prototype.g=function(t){var i=this.T(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.T=function(t){var i=window.performance.getEntriesByName(t);return i[i.length-1]},t.prototype.P=function(t,i){t(i.getEntries())},t}(),i=function(){return(i=Object.assign||function(t){for(var i,n=1,e=arguments.length;n<e;n++)for(var s in i=arguments[n])Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s]);return t}).apply(this,arguments)},n=window,e=window.console;return function(){function s(i){var n=this;void 0===i&&(i={}),this.config={C:!1,F:!1,N:!1,O:!1,L:!1,navigationTiming:!1,j:function(t){},D:"Perfume.js:",k:!0,I:15e3,_:2e4,S:!1,q:!1},this.O=0,this.B=!1,this.K=0,this.M="Please provide a metric name",this.R="Recording already",this.A={},this.G={},this.H=function(){document.hidden&&(n.B=document.hidden)},this.config=Object.assign({},this.config,i),this.J=new t,this.J.isSupported&&(this.J.l&&this.U(),this.V(),this.config.navigationTiming&&this.W())}return Object.defineProperty(s.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.J.navigationTiming:{}},u:!0,m:!0}),s.prototype.start=function(t){this.X(t)&&this.J.isSupported&&(this.A[t]?this.Y(this.R+" started."):(this.A[t]={end:0,start:this.J.now()},this.J.mark(t,"start"),this.B=!1))},s.prototype.end=function(t){var i=this;if(this.X(t)&&this.J.isSupported){var n=this.A[t];if(n){n.end=this.J.now(),this.J.mark(t,"end");var e=this.J.measure(t),s=parseFloat(e.toFixed(2));return delete this.A[t],this.Z((function(){i.log({$:t,duration:s}),i.sendTiming({$:t,duration:s})})),s}this.Y(this.R+" stopped.")}},s.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var e=i.end(t);n(e)}))}))},s.prototype.U=function(){(this.config.F||this.config.C)&&this.tt(),this.it(),this.nt(),this.config.O&&this.et()},s.prototype.X=function(t){return!!t||(this.Y(this.M),!1)},s.prototype.st=function(t,i){void 0===i&&(i=""),this.config.q&&e.log(this.config.D+" debugging "+t+":",i)},s.prototype.P=function(t){var i=this;this.st("PerformanceEntry",t),t.entries.forEach((function(n){i.Z((function(){i.config[t.$]&&(!t.rt||t.rt&&n.name===t.rt)&&i.at(n[t.ot],t.ht,t.$)})),i.G.C&&"first-contentful-paint"===n.name&&i.G.C.disconnect()})),this.G.N&&"firstInputDelay"===t.$&&this.G.N.disconnect()},s.prototype.ut=function(t){var i=this;this.st("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.ct){var n=parseFloat((t.ct/1e3).toFixed(2));i.O+=n}}))},s.prototype.ft=function(t){this.P({entries:t,rt:"first-paint",ht:"First Paint",$:"firstPaint",ot:"startTime"}),this.P({entries:t,rt:"first-contentful-paint",ht:"First Contentful Paint",$:"firstContentfulPaint",ot:"startTime"})},s.prototype.tt=function(){try{this.G.C=this.J.v("paint",this.ft.bind(this))}catch(t){this.Y("FP:failed")}},s.prototype.lt=function(t){this.P({entries:t,ht:"First Input Delay",$:"firstInputDelay",ot:"duration"}),this.config.L&&this.K&&this.at(this.K,"Largest Contentful Paint","largestContentfulPaint"),this.dt()},s.prototype.gt=function(t){this.st("PerformanceEntry:LCP",t);var i=t[t.length-1];this.K=i.vt||i.pt},s.prototype.it=function(){try{this.G.N=this.J.v("first-input",this.lt.bind(this))}catch(t){this.Y("FID:failed")}},s.prototype.nt=function(){try{this.G.L=this.J.v("largest-contentful-paint",this.gt.bind(this))}catch(t){this.Y("LCP:failed")}},s.prototype.bt=function(t){this.ut({entries:t})},s.prototype.dt=function(){clearTimeout(this.Pt),this.G.O&&this.O&&(this.at(this.O,"Data Consumption","dataConsumption","Kb"),this.G.O.disconnect())},s.prototype.et=function(){var t=this;try{this.G.O=this.J.v("resource",this.bt.bind(this))}catch(t){this.Y("DataConsumption:failed")}this.Pt=setTimeout((function(){t.dt()}),15e3)},s.prototype.V=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.H)},s.prototype.log=function(t){var n=i({suffix:"ms"},t),s=n.$,r=n.data,a=n.duration,o=n.suffix;if(!this.B&&this.config.k)if(s){var h="color: #ff6d00;font-size:11px;",u="%c "+this.config.D+" "+s+" ";if(a)u+=a.toFixed(2)+" "+o,e.log(u,h);else r&&e.log(u,h,r)}else this.Y(this.M)},s.prototype.at=function(t,i,n,e){void 0===e&&(e="ms");var s=parseFloat(t.toFixed(2));"dataConsumption"!==n&&s>this.config.I||"dataConsumption"===n&&s>this.config._||(this.log({$:i,duration:s,suffix:e}),this.sendTiming({$:n,duration:s}))},s.prototype.W=function(){this.log({$:"navigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({$:"navigationTiming",data:this.navigationTiming})},s.prototype.Y=function(t){this.config.S&&this.config.k&&e.warn(this.config.D,t)},s.prototype.Z=function(t){"requestIdleCallback"in n?n.wt(t,{timeout:3e3}):t()},s.prototype.sendTiming=function(t){var i=t.$,n=t.data,e=t.duration;this.B||this.config.j({$:i,data:n,duration:e})},s}()}(); | ||
//# sourceMappingURL=perfume.iife.min.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var Performance=function(){function t(){this.t={}}return t.i=function(){return window.performance&&!!performance.getEntriesByType&&!!performance.now&&!!performance.mark},t.s=function(){return window.chrome&&"PerformanceObserver"in window},Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!t.i()||Object.keys(this.t).length)return this.t;var i=performance.getEntriesByType("navigation")[0];return i?(this.t={fetchTime:parseFloat((i.responseEnd-i.fetchStart).toFixed(2)),workerTime:parseFloat((i.o>0?i.responseEnd-i.o:0).toFixed(2)),totalTime:parseFloat((i.responseEnd-i.requestStart).toFixed(2)),downloadTime:parseFloat((i.responseEnd-i.responseStart).toFixed(2)),timeToFirstByte:parseFloat((i.responseStart-i.requestStart).toFixed(2)),headerSize:parseFloat((i.h-i.u).toFixed(2)),dnsLookupTime:parseFloat((i.domainLookupEnd-i.domainLookupStart).toFixed(2))},this.t):this.t},m:!0,l:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,i){var n="mark_"+t+"_"+i;window.performance.mark(n)},t.prototype.measure=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.g(t)},t.prototype.v=function(t,i){return this.p=new PerformanceObserver(this.P.bind(this,i)),this.p.observe({type:t,buffered:!0}),this.p},t.prototype.g=function(t){var i=this.T(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.T=function(t){var i=window.performance.getEntriesByName(t);return i[i.length-1]},t.prototype.P=function(t,i){t(i.getEntries())},t}(),__assign=function(){return(__assign=Object.assign||function(t){for(var i,n=1,e=arguments.length;n<e;n++)for(var s in i=arguments[n])Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s]);return t}).apply(this,arguments)},Perfume=function(){function t(t){var i=this;void 0===t&&(t={}),this.config={C:!1,F:!1,N:!1,_:!1,L:!1,navigationTiming:!1,D:function(t){},O:"Perfume.js:",j:!0,k:15e3,I:2e4,q:!1,B:!1},this._=0,this.K=!1,this.M=0,this.R="Please provide a metric name",this.S="Recording already",this.A={},this.G={},this.H=function(){document.hidden&&(i.K=document.hidden)},this.config=Object.assign({},this.config,t),this.J=new Performance,Performance.i()&&(Performance.s()&&this.U(),this.V(),this.config.navigationTiming&&this.W())}return Object.defineProperty(t.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.J.navigationTiming:{}},m:!0,l:!0}),t.prototype.start=function(t){this.X(t)&&Performance.i()&&(this.A[t]?this.Y(this.S+" started."):(this.A[t]={end:0,start:this.J.now()},this.J.mark(t,"start"),this.K=!1))},t.prototype.end=function(t){var i=this;if(this.X(t)&&Performance.i()){var n=this.A[t];if(n){n.end=this.J.now(),this.J.mark(t,"end");var e=this.J.measure(t),s=parseFloat(e.toFixed(2));return delete this.A[t],this.Z((function(){i.log({$:t,duration:s}),i.sendTiming({$:t,duration:s})})),s}this.Y(this.S+" stopped.")}},t.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var e=i.end(t);n(e)}))}))},t.prototype.logDebug=function(t,i){void 0===i&&(i=""),this.config.B&&window.console.log(this.config.O+" debugging "+t+":",i)},t.prototype.U=function(){(this.config.F||this.config.C)&&this.tt(),this.it(),this.nt(),this.config._&&this.et()},t.prototype.X=function(t){return!!t||(this.Y(this.R),!1)},t.prototype.P=function(t){var i=this;this.logDebug("PerformanceEntry",t),t.entries.forEach((function(n){i.Z((function(){i.config[t.$]&&(!t.st||t.st&&n.name===t.st)&&i.rt(n[t.at],t.ot,t.$)})),i.G.C&&"first-contentful-paint"===n.name&&i.G.C.disconnect()})),this.G.N&&"firstInputDelay"===t.$&&this.G.N.disconnect()},t.prototype.ht=function(t){var i=this;this.logDebug("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.ut){var n=parseFloat((t.ut/1e3).toFixed(2));i._+=n}}))},t.prototype.ft=function(t){this.P({entries:t,st:"first-paint",ot:"First Paint",$:"firstPaint",at:"startTime"}),this.P({entries:t,st:"first-contentful-paint",ot:"First Contentful Paint",$:"firstContentfulPaint",at:"startTime"})},t.prototype.tt=function(){try{this.G.C=this.J.v("paint",this.ft.bind(this))}catch(t){this.Y("FP:failed")}},t.prototype.ct=function(t){this.P({entries:t,ot:"First Input Delay",$:"firstInputDelay",at:"duration"}),this.config.L&&this.M&&this.rt(this.M,"Largest Contentful Paint","largestContentfulPaint"),this.dt()},t.prototype.lt=function(t){this.logDebug("PerformanceEntry:LCP",t);var i=t[t.length-1];this.M=i.gt||i.vt},t.prototype.it=function(){try{this.G.N=this.J.v("first-input",this.ct.bind(this))}catch(t){this.Y("FID:failed")}},t.prototype.nt=function(){try{this.G.L=this.J.v("largest-contentful-paint",this.lt.bind(this))}catch(t){this.Y("LCP:failed")}},t.prototype.pt=function(t){this.ht({entries:t})},t.prototype.dt=function(){clearTimeout(this.wt),this.G._&&this._&&(this.rt(this._,"Data Consumption","dataConsumption","Kb"),this.G._.disconnect())},t.prototype.et=function(){var t=this;try{this.G._=this.J.v("resource",this.pt.bind(this))}catch(t){this.Y("DataConsumption:failed")}this.wt=setTimeout((function(){t.dt()}),15e3)},t.prototype.V=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.H)},t.prototype.log=function(t){var i=__assign({suffix:"ms"},t),n=i.$,e=i.data,s=i.duration,r=i.suffix;if(!this.K&&this.config.j)if(n){var a="color: #ff6d00;font-size:11px;",o="%c "+this.config.O+" "+n+" ";if(s)o+=s.toFixed(2)+" "+r,window.console.log(o,a);else e&&window.console.log(o,a,e)}else this.Y(this.R)},t.prototype.rt=function(t,i,n,e){void 0===e&&(e="ms");var s=parseFloat(t.toFixed(2));"dataConsumption"!==n&&s>this.config.k||"dataConsumption"===n&&s>this.config.I||(this.log({$:i,duration:s,suffix:e}),this.sendTiming({$:n,duration:s}))},t.prototype.W=function(){this.log({$:"navigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({$:"navigationTiming",data:this.navigationTiming})},t.prototype.Y=function(t){this.config.q&&this.config.j&&window.console.warn(this.config.O,t)},t.prototype.Z=function(t){"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.sendTiming=function(t){var i=t.$,n=t.data,e=t.duration;this.K||this.config.D({$:i,data:n,duration:e})},t}();module.exports=Perfume; | ||
"use strict";var Performance=function(){function t(){this.t={},this.w=window,this.i=window.performance}return Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!this.isSupported||Object.keys(this.t).length)return this.t;var t=performance.getEntriesByType("navigation")[0];return t?(this.t={fetchTime:parseFloat((t.responseEnd-t.fetchStart).toFixed(2)),workerTime:parseFloat((t.s>0?t.responseEnd-t.s:0).toFixed(2)),totalTime:parseFloat((t.responseEnd-t.requestStart).toFixed(2)),downloadTime:parseFloat((t.responseEnd-t.responseStart).toFixed(2)),timeToFirstByte:parseFloat((t.responseStart-t.requestStart).toFixed(2)),headerSize:parseFloat((t.o-t.h).toFixed(2)),dnsLookupTime:parseFloat((t.domainLookupEnd-t.domainLookupStart).toFixed(2))},this.t):this.t},u:!0,m:!0}),Object.defineProperty(t.prototype,"isSupported",{get:function(){return this.i&&!!this.i.getEntriesByType&&!!this.i.now&&!!this.i.mark},u:!0,m:!0}),Object.defineProperty(t.prototype,"l",{get:function(){return this.w.chrome&&"PerformanceObserver"in this.w},u:!0,m:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,i){var n="mark_"+t+"_"+i;window.performance.mark(n)},t.prototype.measure=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.g(t)},t.prototype.v=function(t,i){return this.p=new PerformanceObserver(this.P.bind(this,i)),this.p.observe({type:t,buffered:!0}),this.p},t.prototype.g=function(t){var i=this.T(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.T=function(t){var i=window.performance.getEntriesByName(t);return i[i.length-1]},t.prototype.P=function(t,i){t(i.getEntries())},t}(),__assign=function(){return(__assign=Object.assign||function(t){for(var i,n=1,e=arguments.length;n<e;n++)for(var s in i=arguments[n])Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s]);return t}).apply(this,arguments)},w=window,c=window.console,Perfume=function(){function t(t){var i=this;void 0===t&&(t={}),this.config={C:!1,F:!1,N:!1,_:!1,O:!1,navigationTiming:!1,L:function(t){},j:"Perfume.js:",D:!0,k:15e3,I:2e4,S:!1,q:!1},this._=0,this.B=!1,this.K=0,this.M="Please provide a metric name",this.R="Recording already",this.A={},this.G={},this.H=function(){document.hidden&&(i.B=document.hidden)},this.config=Object.assign({},this.config,t),this.J=new Performance,this.J.isSupported&&(this.J.l&&this.U(),this.V(),this.config.navigationTiming&&this.W())}return Object.defineProperty(t.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.J.navigationTiming:{}},u:!0,m:!0}),t.prototype.start=function(t){this.X(t)&&this.J.isSupported&&(this.A[t]?this.Y(this.R+" started."):(this.A[t]={end:0,start:this.J.now()},this.J.mark(t,"start"),this.B=!1))},t.prototype.end=function(t){var i=this;if(this.X(t)&&this.J.isSupported){var n=this.A[t];if(n){n.end=this.J.now(),this.J.mark(t,"end");var e=this.J.measure(t),s=parseFloat(e.toFixed(2));return delete this.A[t],this.Z((function(){i.log({$:t,duration:s}),i.sendTiming({$:t,duration:s})})),s}this.Y(this.R+" stopped.")}},t.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var e=i.end(t);n(e)}))}))},t.prototype.U=function(){(this.config.F||this.config.C)&&this.tt(),this.it(),this.nt(),this.config._&&this.et()},t.prototype.X=function(t){return!!t||(this.Y(this.M),!1)},t.prototype.st=function(t,i){void 0===i&&(i=""),this.config.q&&c.log(this.config.j+" debugging "+t+":",i)},t.prototype.P=function(t){var i=this;this.st("PerformanceEntry",t),t.entries.forEach((function(n){i.Z((function(){i.config[t.$]&&(!t.rt||t.rt&&n.name===t.rt)&&i.at(n[t.ot],t.ht,t.$)})),i.G.C&&"first-contentful-paint"===n.name&&i.G.C.disconnect()})),this.G.N&&"firstInputDelay"===t.$&&this.G.N.disconnect()},t.prototype.ut=function(t){var i=this;this.st("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.ct){var n=parseFloat((t.ct/1e3).toFixed(2));i._+=n}}))},t.prototype.ft=function(t){this.P({entries:t,rt:"first-paint",ht:"First Paint",$:"firstPaint",ot:"startTime"}),this.P({entries:t,rt:"first-contentful-paint",ht:"First Contentful Paint",$:"firstContentfulPaint",ot:"startTime"})},t.prototype.tt=function(){try{this.G.C=this.J.v("paint",this.ft.bind(this))}catch(t){this.Y("FP:failed")}},t.prototype.lt=function(t){this.P({entries:t,ht:"First Input Delay",$:"firstInputDelay",ot:"duration"}),this.config.O&&this.K&&this.at(this.K,"Largest Contentful Paint","largestContentfulPaint"),this.dt()},t.prototype.gt=function(t){this.st("PerformanceEntry:LCP",t);var i=t[t.length-1];this.K=i.vt||i.pt},t.prototype.it=function(){try{this.G.N=this.J.v("first-input",this.lt.bind(this))}catch(t){this.Y("FID:failed")}},t.prototype.nt=function(){try{this.G.O=this.J.v("largest-contentful-paint",this.gt.bind(this))}catch(t){this.Y("LCP:failed")}},t.prototype.Pt=function(t){this.ut({entries:t})},t.prototype.dt=function(){clearTimeout(this.bt),this.G._&&this._&&(this.at(this._,"Data Consumption","dataConsumption","Kb"),this.G._.disconnect())},t.prototype.et=function(){var t=this;try{this.G._=this.J.v("resource",this.Pt.bind(this))}catch(t){this.Y("DataConsumption:failed")}this.bt=setTimeout((function(){t.dt()}),15e3)},t.prototype.V=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.H)},t.prototype.log=function(t){var i=__assign({suffix:"ms"},t),n=i.$,e=i.data,s=i.duration,r=i.suffix;if(!this.B&&this.config.D)if(n){var a="color: #ff6d00;font-size:11px;",o="%c "+this.config.j+" "+n+" ";if(s)o+=s.toFixed(2)+" "+r,c.log(o,a);else e&&c.log(o,a,e)}else this.Y(this.M)},t.prototype.at=function(t,i,n,e){void 0===e&&(e="ms");var s=parseFloat(t.toFixed(2));"dataConsumption"!==n&&s>this.config.k||"dataConsumption"===n&&s>this.config.I||(this.log({$:i,duration:s,suffix:e}),this.sendTiming({$:n,duration:s}))},t.prototype.W=function(){this.log({$:"navigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({$:"navigationTiming",data:this.navigationTiming})},t.prototype.Y=function(t){this.config.S&&this.config.D&&c.warn(this.config.j,t)},t.prototype.Z=function(t){"requestIdleCallback"in w?w.wt(t,{timeout:3e3}):t()},t.prototype.sendTiming=function(t){var i=t.$,n=t.data,e=t.duration;this.B||this.config.L({$:i,data:n,duration:e})},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(){function t(){this.i={}}return t.s=function(){return window.performance&&!!performance.getEntriesByType&&!!performance.now&&!!performance.mark},t.o=function(){return window.chrome&&"PerformanceObserver"in window},Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!t.s()||Object.keys(this.i).length)return this.i;var i=performance.getEntriesByType("navigation")[0];return i?(this.i={fetchTime:parseFloat((i.responseEnd-i.fetchStart).toFixed(2)),workerTime:parseFloat((i.h>0?i.responseEnd-i.h:0).toFixed(2)),totalTime:parseFloat((i.responseEnd-i.requestStart).toFixed(2)),downloadTime:parseFloat((i.responseEnd-i.responseStart).toFixed(2)),timeToFirstByte:parseFloat((i.responseStart-i.requestStart).toFixed(2)),headerSize:parseFloat((i.u-i.m).toFixed(2)),dnsLookupTime:parseFloat((i.domainLookupEnd-i.domainLookupStart).toFixed(2))},this.i):this.i},l:!0,p:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,i){var n="mark_"+t+"_"+i;window.performance.mark(n)},t.prototype.measure=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.v(t)},t.prototype.g=function(t,i){return this.P=new PerformanceObserver(this.T.bind(this,i)),this.P.observe({type:t,buffered:!0}),this.P},t.prototype.v=function(t){var i=this.C(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.C=function(t){var i=window.performance.getEntriesByName(t);return i[i.length-1]},t.prototype.T=function(t,i){t(i.getEntries())},t}(),i=function(){return(i=Object.assign||function(t){for(var i,n=1,e=arguments.length;n<e;n++)for(var s in i=arguments[n])Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s]);return t}).apply(this,arguments)};return function(){function n(i){var n=this;void 0===i&&(i={}),this.config={F:!1,N:!1,L:!1,j:!1,D:!1,navigationTiming:!1,O:function(t){},k:"Perfume.js:",I:!0,_:15e3,q:2e4,B:!1,K:!1},this.j=0,this.M=!1,this.R=0,this.S="Please provide a metric name",this.A="Recording already",this.G={},this.H={},this.J=function(){document.hidden&&(n.M=document.hidden)},this.config=Object.assign({},this.config,i),this.U=new t,t.s()&&(t.o()&&this.V(),this.W(),this.config.navigationTiming&&this.X())}return Object.defineProperty(n.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.U.navigationTiming:{}},l:!0,p:!0}),n.prototype.start=function(i){this.Y(i)&&t.s()&&(this.G[i]?this.Z(this.A+" started."):(this.G[i]={end:0,start:this.U.now()},this.U.mark(i,"start"),this.M=!1))},n.prototype.end=function(i){var n=this;if(this.Y(i)&&t.s()){var e=this.G[i];if(e){e.end=this.U.now(),this.U.mark(i,"end");var s=this.U.measure(i),r=parseFloat(s.toFixed(2));return delete this.G[i],this.$((function(){n.log({tt:i,duration:r}),n.sendTiming({tt:i,duration:r})})),r}this.Z(this.A+" stopped.")}},n.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var e=i.end(t);n(e)}))}))},n.prototype.logDebug=function(t,i){void 0===i&&(i=""),this.config.K&&window.console.log(this.config.k+" debugging "+t+":",i)},n.prototype.V=function(){(this.config.N||this.config.F)&&this.it(),this.nt(),this.et(),this.config.j&&this.st()},n.prototype.Y=function(t){return!!t||(this.Z(this.S),!1)},n.prototype.T=function(t){var i=this;this.logDebug("PerformanceEntry",t),t.entries.forEach((function(n){i.$((function(){i.config[t.tt]&&(!t.rt||t.rt&&n.name===t.rt)&&i.at(n[t.ot],t.ht,t.tt)})),i.H.F&&"first-contentful-paint"===n.name&&i.H.F.disconnect()})),this.H.L&&"firstInputDelay"===t.tt&&this.H.L.disconnect()},n.prototype.ut=function(t){var i=this;this.logDebug("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.ft){var n=parseFloat((t.ft/1e3).toFixed(2));i.j+=n}}))},n.prototype.ct=function(t){this.T({entries:t,rt:"first-paint",ht:"First Paint",tt:"firstPaint",ot:"startTime"}),this.T({entries:t,rt:"first-contentful-paint",ht:"First Contentful Paint",tt:"firstContentfulPaint",ot:"startTime"})},n.prototype.it=function(){try{this.H.F=this.U.g("paint",this.ct.bind(this))}catch(t){this.Z("FP:failed")}},n.prototype.dt=function(t){this.T({entries:t,ht:"First Input Delay",tt:"firstInputDelay",ot:"duration"}),this.config.D&&this.R&&this.at(this.R,"Largest Contentful Paint","largestContentfulPaint"),this.lt()},n.prototype.pt=function(t){this.logDebug("PerformanceEntry:LCP",t);var i=t[t.length-1];this.R=i.vt||i.gt},n.prototype.nt=function(){try{this.H.L=this.U.g("first-input",this.dt.bind(this))}catch(t){this.Z("FID:failed")}},n.prototype.et=function(){try{this.H.D=this.U.g("largest-contentful-paint",this.pt.bind(this))}catch(t){this.Z("LCP:failed")}},n.prototype.wt=function(t){this.ut({entries:t})},n.prototype.lt=function(){clearTimeout(this.yt),this.H.j&&this.j&&(this.at(this.j,"Data Consumption","dataConsumption","Kb"),this.H.j.disconnect())},n.prototype.st=function(){var t=this;try{this.H.j=this.U.g("resource",this.wt.bind(this))}catch(t){this.Z("DataConsumption:failed")}this.yt=setTimeout((function(){t.lt()}),15e3)},n.prototype.W=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.J)},n.prototype.log=function(t){var n=i({suffix:"ms"},t),e=n.tt,s=n.data,r=n.duration,a=n.suffix;if(!this.M&&this.config.I)if(e){var o="color: #ff6d00;font-size:11px;",h="%c "+this.config.k+" "+e+" ";if(r)h+=r.toFixed(2)+" "+a,window.console.log(h,o);else s&&window.console.log(h,o,s)}else this.Z(this.S)},n.prototype.at=function(t,i,n,e){void 0===e&&(e="ms");var s=parseFloat(t.toFixed(2));"dataConsumption"!==n&&s>this.config._||"dataConsumption"===n&&s>this.config.q||(this.log({tt:i,duration:s,suffix:e}),this.sendTiming({tt:n,duration:s}))},n.prototype.X=function(){this.log({tt:"navigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({tt:"navigationTiming",data:this.navigationTiming})},n.prototype.Z=function(t){this.config.B&&this.config.I&&window.console.warn(this.config.k,t)},n.prototype.$=function(t){"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:3e3}):t()},n.prototype.sendTiming=function(t){var i=t.tt,n=t.data,e=t.duration;this.M||this.config.O({tt:i,data:n,duration:e})},n}()})); | ||
!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(){function t(){this.i={},this.w=window,this.s=window.performance}return Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!this.isSupported||Object.keys(this.i).length)return this.i;var t=performance.getEntriesByType("navigation")[0];return t?(this.i={fetchTime:parseFloat((t.responseEnd-t.fetchStart).toFixed(2)),workerTime:parseFloat((t.o>0?t.responseEnd-t.o:0).toFixed(2)),totalTime:parseFloat((t.responseEnd-t.requestStart).toFixed(2)),downloadTime:parseFloat((t.responseEnd-t.responseStart).toFixed(2)),timeToFirstByte:parseFloat((t.responseStart-t.requestStart).toFixed(2)),headerSize:parseFloat((t.h-t.u).toFixed(2)),dnsLookupTime:parseFloat((t.domainLookupEnd-t.domainLookupStart).toFixed(2))},this.i):this.i},m:!0,l:!0}),Object.defineProperty(t.prototype,"isSupported",{get:function(){return this.s&&!!this.s.getEntriesByType&&!!this.s.now&&!!this.s.mark},m:!0,l:!0}),Object.defineProperty(t.prototype,"g",{get:function(){return this.w.chrome&&"PerformanceObserver"in this.w},m:!0,l:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,i){var n="mark_"+t+"_"+i;window.performance.mark(n)},t.prototype.measure=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.p(t)},t.prototype.v=function(t,i){return this.P=new PerformanceObserver(this.T.bind(this,i)),this.P.observe({type:t,buffered:!0}),this.P},t.prototype.p=function(t){var i=this.C(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.C=function(t){var i=window.performance.getEntriesByName(t);return i[i.length-1]},t.prototype.T=function(t,i){t(i.getEntries())},t}(),i=function(){return(i=Object.assign||function(t){for(var i,n=1,e=arguments.length;n<e;n++)for(var s in i=arguments[n])Object.prototype.hasOwnProperty.call(i,s)&&(t[s]=i[s]);return t}).apply(this,arguments)},n=window,e=window.console;return function(){function s(i){var n=this;void 0===i&&(i={}),this.config={F:!1,N:!1,O:!1,j:!1,L:!1,navigationTiming:!1,D:function(t){},k:"Perfume.js:",I:!0,_:15e3,S:2e4,q:!1,B:!1},this.j=0,this.K=!1,this.M=0,this.R="Please provide a metric name",this.A="Recording already",this.G={},this.H={},this.J=function(){document.hidden&&(n.K=document.hidden)},this.config=Object.assign({},this.config,i),this.U=new t,this.U.isSupported&&(this.U.g&&this.V(),this.W(),this.config.navigationTiming&&this.X())}return Object.defineProperty(s.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.U.navigationTiming:{}},m:!0,l:!0}),s.prototype.start=function(t){this.Y(t)&&this.U.isSupported&&(this.G[t]?this.Z(this.A+" started."):(this.G[t]={end:0,start:this.U.now()},this.U.mark(t,"start"),this.K=!1))},s.prototype.end=function(t){var i=this;if(this.Y(t)&&this.U.isSupported){var n=this.G[t];if(n){n.end=this.U.now(),this.U.mark(t,"end");var e=this.U.measure(t),s=parseFloat(e.toFixed(2));return delete this.G[t],this.$((function(){i.log({tt:t,duration:s}),i.sendTiming({tt:t,duration:s})})),s}this.Z(this.A+" stopped.")}},s.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var e=i.end(t);n(e)}))}))},s.prototype.V=function(){(this.config.N||this.config.F)&&this.it(),this.nt(),this.et(),this.config.j&&this.st()},s.prototype.Y=function(t){return!!t||(this.Z(this.R),!1)},s.prototype.rt=function(t,i){void 0===i&&(i=""),this.config.B&&e.log(this.config.k+" debugging "+t+":",i)},s.prototype.T=function(t){var i=this;this.rt("PerformanceEntry",t),t.entries.forEach((function(n){i.$((function(){i.config[t.tt]&&(!t.at||t.at&&n.name===t.at)&&i.ot(n[t.ht],t.ut,t.tt)})),i.H.F&&"first-contentful-paint"===n.name&&i.H.F.disconnect()})),this.H.O&&"firstInputDelay"===t.tt&&this.H.O.disconnect()},s.prototype.ft=function(t){var i=this;this.rt("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.ct){var n=parseFloat((t.ct/1e3).toFixed(2));i.j+=n}}))},s.prototype.dt=function(t){this.T({entries:t,at:"first-paint",ut:"First Paint",tt:"firstPaint",ht:"startTime"}),this.T({entries:t,at:"first-contentful-paint",ut:"First Contentful Paint",tt:"firstContentfulPaint",ht:"startTime"})},s.prototype.it=function(){try{this.H.F=this.U.v("paint",this.dt.bind(this))}catch(t){this.Z("FP:failed")}},s.prototype.lt=function(t){this.T({entries:t,ut:"First Input Delay",tt:"firstInputDelay",ht:"duration"}),this.config.L&&this.M&&this.ot(this.M,"Largest Contentful Paint","largestContentfulPaint"),this.gt()},s.prototype.pt=function(t){this.rt("PerformanceEntry:LCP",t);var i=t[t.length-1];this.M=i.vt||i.bt},s.prototype.nt=function(){try{this.H.O=this.U.v("first-input",this.lt.bind(this))}catch(t){this.Z("FID:failed")}},s.prototype.et=function(){try{this.H.L=this.U.v("largest-contentful-paint",this.pt.bind(this))}catch(t){this.Z("LCP:failed")}},s.prototype.wt=function(t){this.ft({entries:t})},s.prototype.gt=function(){clearTimeout(this.Pt),this.H.j&&this.j&&(this.ot(this.j,"Data Consumption","dataConsumption","Kb"),this.H.j.disconnect())},s.prototype.st=function(){var t=this;try{this.H.j=this.U.v("resource",this.wt.bind(this))}catch(t){this.Z("DataConsumption:failed")}this.Pt=setTimeout((function(){t.gt()}),15e3)},s.prototype.W=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.J)},s.prototype.log=function(t){var n=i({suffix:"ms"},t),s=n.tt,r=n.data,a=n.duration,o=n.suffix;if(!this.K&&this.config.I)if(s){var h="color: #ff6d00;font-size:11px;",u="%c "+this.config.k+" "+s+" ";if(a)u+=a.toFixed(2)+" "+o,e.log(u,h);else r&&e.log(u,h,r)}else this.Z(this.R)},s.prototype.ot=function(t,i,n,e){void 0===e&&(e="ms");var s=parseFloat(t.toFixed(2));"dataConsumption"!==n&&s>this.config._||"dataConsumption"===n&&s>this.config.S||(this.log({tt:i,duration:s,suffix:e}),this.sendTiming({tt:n,duration:s}))},s.prototype.X=function(){this.log({tt:"navigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({tt:"navigationTiming",data:this.navigationTiming})},s.prototype.Z=function(t){this.config.q&&this.config.I&&e.warn(this.config.k,t)},s.prototype.$=function(t){"requestIdleCallback"in n?n.yt(t,{timeout:3e3}):t()},s.prototype.sendTiming=function(t){var i=t.tt,n=t.data,e=t.duration;this.K||this.config.D({tt:i,data:n,duration:e})},s}()})); | ||
//# sourceMappingURL=perfume.umd.min.js.map |
@@ -37,3 +37,13 @@ export interface IMetricEntry { | ||
export default class Performance { | ||
navigationTimingCached: IPerfumeNavigationTiming; | ||
private perfObserver; | ||
private w; | ||
private wp; | ||
/** | ||
* Navigation Timing API provides performance metrics for HTML documents. | ||
* w3c.github.io/navigation-timing/ | ||
* developers.google.com/web/fundamentals/performance/navigation-and-resource-timing | ||
*/ | ||
get navigationTiming(): IPerfumeNavigationTiming; | ||
/** | ||
* True if the browser supports the Navigation Timing API, | ||
@@ -47,3 +57,3 @@ * User Timing API and the PerformanceObserver Interface. | ||
*/ | ||
static supported(): boolean; | ||
get isSupported(): boolean; | ||
/** | ||
@@ -54,12 +64,4 @@ * For now only Chrome fully support the PerformanceObserver interface | ||
*/ | ||
static supportedPerformanceObserver(): boolean; | ||
navigationTimingCached: IPerfumeNavigationTiming; | ||
private perfObserver; | ||
get isSupportedPerformanceObserver(): boolean; | ||
/** | ||
* Navigation Timing API provides performance metrics for HTML documents. | ||
* w3c.github.io/navigation-timing/ | ||
* developers.google.com/web/fundamentals/performance/navigation-and-resource-timing | ||
*/ | ||
readonly navigationTiming: IPerfumeNavigationTiming; | ||
/** | ||
* When performance API available | ||
@@ -66,0 +68,0 @@ * returns a DOMHighResTimeStamp, measured in milliseconds, accurate to five |
/*! | ||
* Perfume.js v4.0.0-rc2 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v4.0.0-rc3 (http://zizzamia.github.io/perfume) | ||
* Copyright 2018 The Perfume Authors (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
@@ -73,3 +73,3 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
constructor(options?: IPerfumeOptions); | ||
readonly navigationTiming: IPerfumeNavigationTiming; | ||
get navigationTiming(): IPerfumeNavigationTiming; | ||
/** | ||
@@ -87,6 +87,2 @@ * Start performance measurement | ||
endPaint(metricName: string): Promise<void | number>; | ||
/** | ||
* Coloring Debugging Text in Browser Console | ||
*/ | ||
logDebug(methodName: string, debugValue?: any): void; | ||
private initPerformanceObserver; | ||
@@ -96,2 +92,6 @@ private checkMetricName; | ||
/** | ||
* Coloring Debugging Text in Browser Console | ||
*/ | ||
private logDebug; | ||
/** | ||
* Logging Performance Paint Timing | ||
@@ -98,0 +98,0 @@ */ |
{ | ||
"name": "perfume.js", | ||
"version": "4.0.0-rc2", | ||
"version": "4.0.0-rc3", | ||
"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.", | ||
@@ -91,13 +91,13 @@ "keywords": [ | ||
"@angular/core": "8.1.0", | ||
"@types/jest": "24.0.15", | ||
"@types/node": "12.0.10", | ||
"colors": "1.3.3", | ||
"commitizen": "^4.0.3", | ||
"coveralls": "3.0.4", | ||
"husky": "3.0.0", | ||
"jest": "24.8.0", | ||
"lint-staged": "9.0.1", | ||
"prettier": "1.18.2", | ||
"@types/jest": "24.0.23", | ||
"@types/node": "12.12.8", | ||
"colors": "1.4.0", | ||
"commitizen": "4.0.3", | ||
"coveralls": "3.0.7", | ||
"husky": "3.0.9", | ||
"jest": "24.9.0", | ||
"lint-staged": "9.4.3", | ||
"prettier": "1.19.1", | ||
"rimraf": "2.6.3", | ||
"rollup": "1.21.3", | ||
"rollup": "1.27.0", | ||
"rollup-plugin-commonjs": "10.1.0", | ||
@@ -107,11 +107,11 @@ "rollup-plugin-node-resolve": "5.2.0", | ||
"rollup-plugin-terser": "5.1.2", | ||
"ts-jest": "24.0.2", | ||
"ts-node": "8.3.0", | ||
"tslint": "5.18.0", | ||
"tslint-config-airbnb": "5.11.1", | ||
"ts-jest": "24.1.0", | ||
"ts-node": "8.5.2", | ||
"tslint": "5.20.1", | ||
"tslint-config-airbnb": "5.11.2", | ||
"tslint-config-prettier": "1.18.0", | ||
"tslint-plugin-prettier": "2.0.1", | ||
"typescript": "3.5.2", | ||
"typescript": "3.7.2", | ||
"validate-commit-msg": "1.1.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
363019
2195