perfume.js
Advanced tools
# Changelog | ||
## 5.0.0-rc.16 (2020-3-30) | ||
* **refactor:** reduced library kb part X | ||
* **fix:** added extra check to remove observer reference | ||
## 5.0.0-rc.15 (2020-3-26) | ||
@@ -4,0 +9,0 @@ |
import { logData, logMetric } from './log'; | ||
import { cls, clsMetricName, lcp, lcpMetricName, rt, tbt, tbtMetricName, } from './metrics'; | ||
import { poDisconnect } from './performanceObserver'; | ||
import { perfObservers } from './observeInstances'; | ||
@@ -9,25 +10,23 @@ export var initFirstInputDelay = function (performanceEntries) { | ||
} | ||
perfObservers.fid.disconnect(); | ||
if (perfObservers.lcp) { | ||
poDisconnect(1); | ||
if (perfObservers[2]) { | ||
logMetric(lcp.value, lcpMetricName); | ||
} | ||
if (perfObservers.cls) { | ||
perfObservers.cls.takeRecords(); | ||
if (perfObservers[3]) { | ||
perfObservers[3].takeRecords(); | ||
logMetric(cls.value, clsMetricName); | ||
} | ||
// TBT by FID | ||
if (perfObservers.tbt) { | ||
if (perfObservers[4]) { | ||
logMetric(tbt.value, tbtMetricName); | ||
// TBT with 5 second delay after FID | ||
setTimeout(function () { | ||
logMetric(tbt.value, tbtMetricName + "5S"); | ||
}, 5000); | ||
} | ||
// TBT with 5 second delay after FID | ||
setTimeout(function () { | ||
if (perfObservers.tbt) { | ||
logMetric(tbt.value, tbtMetricName + "5S"); | ||
} | ||
}, 5000); | ||
// TBT with 10 second delay after FID | ||
setTimeout(function () { | ||
if (perfObservers.tbt) { | ||
if (perfObservers[4]) { | ||
logMetric(tbt.value, tbtMetricName + "10S"); | ||
perfObservers.tbt.disconnect(); | ||
poDisconnect(4); | ||
} | ||
@@ -34,0 +33,0 @@ // Report Data Consumption |
import { config } from './config'; | ||
import { reportPerf } from './reportPerf'; | ||
import { pushTask, roundByTwo } from './utils'; | ||
import { roundByTwo } from './utils'; | ||
export var logData = function (measureName, metric, customProperties) { | ||
@@ -10,6 +10,4 @@ Object.keys(metric).forEach(function (key) { | ||
}); | ||
pushTask(function () { | ||
// Sends the metric to an external tracking service | ||
reportPerf(measureName, metric, customProperties); | ||
}); | ||
// Sends the metric to an external tracking service | ||
reportPerf(measureName, metric, customProperties); | ||
}; | ||
@@ -22,11 +20,7 @@ /** | ||
var duration2Decimal = roundByTwo(duration); | ||
// Stop Analytics and Logging for false negative metrics | ||
if (duration2Decimal > config.maxTime || duration2Decimal <= 0) { | ||
return; | ||
} | ||
pushTask(function () { | ||
if (duration2Decimal <= config.maxTime && duration2Decimal > 0) { | ||
// Sends the metric to an external tracking service | ||
reportPerf(measureName, duration2Decimal); | ||
}); | ||
} | ||
}; | ||
//# sourceMappingURL=log.js.map |
import { WP } from './constants'; | ||
/** | ||
* Get the duration of the timing metric or -1 if there a measurement has | ||
* not been made by the User Timing API | ||
* Get the duration of the timing metric or -1 | ||
* if there a measurement has not been made by the User Timing API | ||
*/ | ||
export var getDurationByMetric = function (measureName) { | ||
var performanceEntries = WP.getEntriesByName(measureName); | ||
var entry = performanceEntries[performanceEntries.length - 1]; | ||
export var performanceMeasure = function (measureName) { | ||
WP.measure(measureName, "mark_" + measureName + "_start", "mark_" + measureName + "_end"); | ||
var entry = WP.getEntriesByName(measureName).pop(); | ||
if (entry && entry.entryType === 'measure') { | ||
@@ -14,6 +14,2 @@ return entry.duration; | ||
}; | ||
export var performanceMeasure = function (measureName) { | ||
WP.measure(measureName, "mark_" + measureName + "_start", "mark_" + measureName + "_end"); | ||
return getDurationByMetric(measureName); | ||
}; | ||
//# sourceMappingURL=measure.js.map |
@@ -8,10 +8,10 @@ import { config } from './config'; | ||
import { initFirstPaint, initLargestContentfulPaint } from './paint'; | ||
import { po } from './performanceObserver'; | ||
import { po, poDisconnect } from './performanceObserver'; | ||
import { initResourceTiming } from './resourceTiming'; | ||
export var initPerformanceObserver = function () { | ||
perfObservers.fcp = po('paint', initFirstPaint); | ||
perfObservers[0] = po('paint', initFirstPaint); | ||
// FID needs to be initialized as soon as Perfume is available | ||
// DataConsumption resolves after FID is triggered | ||
perfObservers.fid = po('first-input', initFirstInputDelay); | ||
perfObservers.lcp = po('largest-contentful-paint', initLargestContentfulPaint); | ||
perfObservers[1] = po('first-input', initFirstInputDelay); | ||
perfObservers[2] = po('largest-contentful-paint', initLargestContentfulPaint); | ||
// Collects KB information related to resources on the page | ||
@@ -21,15 +21,15 @@ if (config.isResourceTiming) { | ||
} | ||
perfObservers.cls = po('layout-shift', initLayoutShift); | ||
perfObservers[3] = po('layout-shift', initLayoutShift); | ||
}; | ||
export var disconnectPerfObserversHidden = function () { | ||
if (perfObservers.lcp) { | ||
if (perfObservers[2]) { | ||
logMetric(lcp.value, lcpMetricName + "Final"); | ||
perfObservers.lcp.disconnect(); | ||
poDisconnect(2); | ||
} | ||
if (perfObservers.cls) { | ||
perfObservers.cls.takeRecords(); | ||
if (perfObservers[3]) { | ||
perfObservers[3].takeRecords(); | ||
logMetric(cls.value, clsMetricName + "Final"); | ||
perfObservers.cls.disconnect(); | ||
poDisconnect(3); | ||
} | ||
}; | ||
//# sourceMappingURL=observe.js.map |
import { logMetric } from './log'; | ||
import { fcp, fcpEntryName, lcp } from './metrics'; | ||
import { perfObservers } from './observeInstances'; | ||
import { po } from './performanceObserver'; | ||
import { po, poDisconnect } from './performanceObserver'; | ||
import { initTotalBlockingTime } from './totalBlockingTime'; | ||
@@ -16,8 +16,6 @@ /** | ||
else if (performanceEntry.name === fcpEntryName) { | ||
logMetric(performanceEntry.startTime, 'fcp'); | ||
} | ||
if (performanceEntry.name === fcpEntryName) { | ||
fcp.value = performanceEntry.startTime; | ||
perfObservers.tbt = po('longtask', initTotalBlockingTime); | ||
perfObservers.fcp.disconnect(); | ||
logMetric(fcp.value, 'fcp'); | ||
perfObservers[4] = po('longtask', initTotalBlockingTime); | ||
poDisconnect(0); | ||
} | ||
@@ -24,0 +22,0 @@ }); |
import { C } from './constants'; | ||
import { perfObservers } from './observeInstances'; | ||
/** | ||
@@ -20,2 +21,6 @@ * PerformanceObserver subscribes to performance events as they happen | ||
}; | ||
export var poDisconnect = function (observer) { | ||
perfObservers[observer].disconnect(); | ||
delete perfObservers[observer]; | ||
}; | ||
//# sourceMappingURL=performanceObserver.js.map |
/*! | ||
* Perfume.js v5.0.0-rc.15 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v5.0.0-rc.16 (http://zizzamia.github.io/perfume) | ||
* Copyright 2020 Leonardo Zizzamia (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
@@ -8,3 +8,3 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
import { config } from './config'; | ||
import { W, WP } from './constants'; | ||
import { W, WN, WP } from './constants'; | ||
import { getNavigationTiming } from './getNavigationTiming'; | ||
@@ -18,6 +18,6 @@ import { getNetworkInformation } from './getNetworkInformation'; | ||
import { onVisibilityChange, visibility } from './onVisibilityChange'; | ||
import { initStorageEstimate } from './storageEstimate'; | ||
import { reportStorageEstimate } from './storageEstimate'; | ||
import { roundByTwo } from './utils'; | ||
var AUTHOR = 'Leonardo Zizzamia'; | ||
var VERSION = '5.0.0-rc.15'; | ||
var VERSION = '5.0.0-rc.16'; | ||
var Perfume = /** @class */ (function () { | ||
@@ -45,3 +45,5 @@ function Perfume(options) { | ||
// Let's estimate our storage capacity | ||
initStorageEstimate(); | ||
if (WN && WN.storage) { | ||
WN.storage.estimate().then(reportStorageEstimate); | ||
} | ||
} | ||
@@ -48,0 +50,0 @@ /** |
import { config } from './config'; | ||
import { getNavigatorInfo } from './getNavigatorInfo'; | ||
import { visibility } from './onVisibilityChange'; | ||
import { pushTask } from './utils'; | ||
/** | ||
@@ -8,15 +9,17 @@ * Sends the User timing measure to analyticsTracker | ||
export var reportPerf = function (measureName, data, customProperties) { | ||
// Doesn't send timing when page is hidden | ||
if ((visibility.isHidden && measureName.indexOf('Final') < 0) || | ||
!config.analyticsTracker) { | ||
return; | ||
} | ||
// Send metric to custom Analytics service | ||
config.analyticsTracker({ | ||
metricName: measureName, | ||
data: data, | ||
eventProperties: customProperties || {}, | ||
navigatorInformation: getNavigatorInfo(), | ||
pushTask(function () { | ||
// Doesn't send timing when page is hidden | ||
if ((visibility.isHidden && measureName.indexOf('Final') < 0) || | ||
!config.analyticsTracker) { | ||
return; | ||
} | ||
// Send metric to custom Analytics service | ||
config.analyticsTracker({ | ||
metricName: measureName, | ||
data: data, | ||
eventProperties: customProperties || {}, | ||
navigatorInformation: getNavigatorInfo(), | ||
}); | ||
}); | ||
}; | ||
//# sourceMappingURL=reportPerf.js.map |
@@ -1,2 +0,1 @@ | ||
import { WN } from './constants'; | ||
import { logData } from './log'; | ||
@@ -9,12 +8,4 @@ import { convertToKB } from './utils'; | ||
*/ | ||
export var initStorageEstimate = function () { | ||
if (WN && WN.storage) { | ||
WN.storage.estimate().then(reportStorageEstimate); | ||
} | ||
}; | ||
export var reportStorageEstimate = function (storageInfo) { | ||
var estimateUsageDetails = {}; | ||
if ('usageDetails' in storageInfo) { | ||
estimateUsageDetails = storageInfo.usageDetails; | ||
} | ||
var estimateUsageDetails = 'usageDetails' in storageInfo ? storageInfo.usageDetails : {}; | ||
logData('storageEstimate', { | ||
@@ -21,0 +12,0 @@ quota: convertToKB(storageInfo.quota), |
@@ -5,2 +5,3 @@ "use strict"; | ||
var metrics_1 = require("./metrics"); | ||
var performanceObserver_1 = require("./performanceObserver"); | ||
var observeInstances_1 = require("./observeInstances"); | ||
@@ -12,25 +13,23 @@ exports.initFirstInputDelay = function (performanceEntries) { | ||
} | ||
observeInstances_1.perfObservers.fid.disconnect(); | ||
if (observeInstances_1.perfObservers.lcp) { | ||
performanceObserver_1.poDisconnect(1); | ||
if (observeInstances_1.perfObservers[2]) { | ||
log_1.logMetric(metrics_1.lcp.value, metrics_1.lcpMetricName); | ||
} | ||
if (observeInstances_1.perfObservers.cls) { | ||
observeInstances_1.perfObservers.cls.takeRecords(); | ||
if (observeInstances_1.perfObservers[3]) { | ||
observeInstances_1.perfObservers[3].takeRecords(); | ||
log_1.logMetric(metrics_1.cls.value, metrics_1.clsMetricName); | ||
} | ||
// TBT by FID | ||
if (observeInstances_1.perfObservers.tbt) { | ||
if (observeInstances_1.perfObservers[4]) { | ||
log_1.logMetric(metrics_1.tbt.value, metrics_1.tbtMetricName); | ||
// TBT with 5 second delay after FID | ||
setTimeout(function () { | ||
log_1.logMetric(metrics_1.tbt.value, metrics_1.tbtMetricName + "5S"); | ||
}, 5000); | ||
} | ||
// TBT with 5 second delay after FID | ||
setTimeout(function () { | ||
if (observeInstances_1.perfObservers.tbt) { | ||
log_1.logMetric(metrics_1.tbt.value, metrics_1.tbtMetricName + "5S"); | ||
} | ||
}, 5000); | ||
// TBT with 10 second delay after FID | ||
setTimeout(function () { | ||
if (observeInstances_1.perfObservers.tbt) { | ||
if (observeInstances_1.perfObservers[4]) { | ||
log_1.logMetric(metrics_1.tbt.value, metrics_1.tbtMetricName + "10S"); | ||
observeInstances_1.perfObservers.tbt.disconnect(); | ||
performanceObserver_1.poDisconnect(4); | ||
} | ||
@@ -37,0 +36,0 @@ // Report Data Consumption |
@@ -12,6 +12,4 @@ "use strict"; | ||
}); | ||
utils_1.pushTask(function () { | ||
// Sends the metric to an external tracking service | ||
reportPerf_1.reportPerf(measureName, metric, customProperties); | ||
}); | ||
// Sends the metric to an external tracking service | ||
reportPerf_1.reportPerf(measureName, metric, customProperties); | ||
}; | ||
@@ -24,11 +22,7 @@ /** | ||
var duration2Decimal = utils_1.roundByTwo(duration); | ||
// Stop Analytics and Logging for false negative metrics | ||
if (duration2Decimal > config_1.config.maxTime || duration2Decimal <= 0) { | ||
return; | ||
} | ||
utils_1.pushTask(function () { | ||
if (duration2Decimal <= config_1.config.maxTime && duration2Decimal > 0) { | ||
// Sends the metric to an external tracking service | ||
reportPerf_1.reportPerf(measureName, duration2Decimal); | ||
}); | ||
} | ||
}; | ||
//# sourceMappingURL=log.js.map |
@@ -5,8 +5,8 @@ "use strict"; | ||
/** | ||
* Get the duration of the timing metric or -1 if there a measurement has | ||
* not been made by the User Timing API | ||
* Get the duration of the timing metric or -1 | ||
* if there a measurement has not been made by the User Timing API | ||
*/ | ||
exports.getDurationByMetric = function (measureName) { | ||
var performanceEntries = constants_1.WP.getEntriesByName(measureName); | ||
var entry = performanceEntries[performanceEntries.length - 1]; | ||
exports.performanceMeasure = function (measureName) { | ||
constants_1.WP.measure(measureName, "mark_" + measureName + "_start", "mark_" + measureName + "_end"); | ||
var entry = constants_1.WP.getEntriesByName(measureName).pop(); | ||
if (entry && entry.entryType === 'measure') { | ||
@@ -17,6 +17,2 @@ return entry.duration; | ||
}; | ||
exports.performanceMeasure = function (measureName) { | ||
constants_1.WP.measure(measureName, "mark_" + measureName + "_start", "mark_" + measureName + "_end"); | ||
return exports.getDurationByMetric(measureName); | ||
}; | ||
//# sourceMappingURL=measure.js.map |
@@ -13,7 +13,7 @@ "use strict"; | ||
exports.initPerformanceObserver = function () { | ||
observeInstances_1.perfObservers.fcp = performanceObserver_1.po('paint', paint_1.initFirstPaint); | ||
observeInstances_1.perfObservers[0] = performanceObserver_1.po('paint', paint_1.initFirstPaint); | ||
// FID needs to be initialized as soon as Perfume is available | ||
// DataConsumption resolves after FID is triggered | ||
observeInstances_1.perfObservers.fid = performanceObserver_1.po('first-input', firstInput_1.initFirstInputDelay); | ||
observeInstances_1.perfObservers.lcp = performanceObserver_1.po('largest-contentful-paint', paint_1.initLargestContentfulPaint); | ||
observeInstances_1.perfObservers[1] = performanceObserver_1.po('first-input', firstInput_1.initFirstInputDelay); | ||
observeInstances_1.perfObservers[2] = performanceObserver_1.po('largest-contentful-paint', paint_1.initLargestContentfulPaint); | ||
// Collects KB information related to resources on the page | ||
@@ -23,15 +23,15 @@ if (config_1.config.isResourceTiming) { | ||
} | ||
observeInstances_1.perfObservers.cls = performanceObserver_1.po('layout-shift', cumulativeLayoutShift_1.initLayoutShift); | ||
observeInstances_1.perfObservers[3] = performanceObserver_1.po('layout-shift', cumulativeLayoutShift_1.initLayoutShift); | ||
}; | ||
exports.disconnectPerfObserversHidden = function () { | ||
if (observeInstances_1.perfObservers.lcp) { | ||
if (observeInstances_1.perfObservers[2]) { | ||
log_1.logMetric(metrics_1.lcp.value, metrics_1.lcpMetricName + "Final"); | ||
observeInstances_1.perfObservers.lcp.disconnect(); | ||
performanceObserver_1.poDisconnect(2); | ||
} | ||
if (observeInstances_1.perfObservers.cls) { | ||
observeInstances_1.perfObservers.cls.takeRecords(); | ||
if (observeInstances_1.perfObservers[3]) { | ||
observeInstances_1.perfObservers[3].takeRecords(); | ||
log_1.logMetric(metrics_1.cls.value, metrics_1.clsMetricName + "Final"); | ||
observeInstances_1.perfObservers.cls.disconnect(); | ||
performanceObserver_1.poDisconnect(3); | ||
} | ||
}; | ||
//# sourceMappingURL=observe.js.map |
@@ -18,8 +18,6 @@ "use strict"; | ||
else if (performanceEntry.name === metrics_1.fcpEntryName) { | ||
log_1.logMetric(performanceEntry.startTime, 'fcp'); | ||
} | ||
if (performanceEntry.name === metrics_1.fcpEntryName) { | ||
metrics_1.fcp.value = performanceEntry.startTime; | ||
observeInstances_1.perfObservers.tbt = performanceObserver_1.po('longtask', totalBlockingTime_1.initTotalBlockingTime); | ||
observeInstances_1.perfObservers.fcp.disconnect(); | ||
log_1.logMetric(metrics_1.fcp.value, 'fcp'); | ||
observeInstances_1.perfObservers[4] = performanceObserver_1.po('longtask', totalBlockingTime_1.initTotalBlockingTime); | ||
performanceObserver_1.poDisconnect(0); | ||
} | ||
@@ -26,0 +24,0 @@ }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var constants_1 = require("./constants"); | ||
var observeInstances_1 = require("./observeInstances"); | ||
/** | ||
@@ -22,2 +23,6 @@ * PerformanceObserver subscribes to performance events as they happen | ||
}; | ||
exports.poDisconnect = function (observer) { | ||
observeInstances_1.perfObservers[observer].disconnect(); | ||
delete observeInstances_1.perfObservers[observer]; | ||
}; | ||
//# sourceMappingURL=performanceObserver.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/*! | ||
* Perfume.js v5.0.0-rc.15 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v5.0.0-rc.16 (http://zizzamia.github.io/perfume) | ||
* Copyright 2020 Leonardo Zizzamia (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
@@ -22,3 +22,3 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
var AUTHOR = 'Leonardo Zizzamia'; | ||
var VERSION = '5.0.0-rc.15'; | ||
var VERSION = '5.0.0-rc.16'; | ||
var Perfume = /** @class */ (function () { | ||
@@ -46,3 +46,5 @@ function Perfume(options) { | ||
// Let's estimate our storage capacity | ||
storageEstimate_1.initStorageEstimate(); | ||
if (constants_1.WN && constants_1.WN.storage) { | ||
constants_1.WN.storage.estimate().then(storageEstimate_1.reportStorageEstimate); | ||
} | ||
} | ||
@@ -49,0 +51,0 @@ /** |
@@ -6,2 +6,3 @@ "use strict"; | ||
var onVisibilityChange_1 = require("./onVisibilityChange"); | ||
var utils_1 = require("./utils"); | ||
/** | ||
@@ -11,15 +12,17 @@ * Sends the User timing measure to analyticsTracker | ||
exports.reportPerf = function (measureName, data, customProperties) { | ||
// Doesn't send timing when page is hidden | ||
if ((onVisibilityChange_1.visibility.isHidden && measureName.indexOf('Final') < 0) || | ||
!config_1.config.analyticsTracker) { | ||
return; | ||
} | ||
// Send metric to custom Analytics service | ||
config_1.config.analyticsTracker({ | ||
metricName: measureName, | ||
data: data, | ||
eventProperties: customProperties || {}, | ||
navigatorInformation: getNavigatorInfo_1.getNavigatorInfo(), | ||
utils_1.pushTask(function () { | ||
// Doesn't send timing when page is hidden | ||
if ((onVisibilityChange_1.visibility.isHidden && measureName.indexOf('Final') < 0) || | ||
!config_1.config.analyticsTracker) { | ||
return; | ||
} | ||
// Send metric to custom Analytics service | ||
config_1.config.analyticsTracker({ | ||
metricName: measureName, | ||
data: data, | ||
eventProperties: customProperties || {}, | ||
navigatorInformation: getNavigatorInfo_1.getNavigatorInfo(), | ||
}); | ||
}); | ||
}; | ||
//# sourceMappingURL=reportPerf.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var constants_1 = require("./constants"); | ||
var log_1 = require("./log"); | ||
@@ -11,12 +10,4 @@ var utils_1 = require("./utils"); | ||
*/ | ||
exports.initStorageEstimate = function () { | ||
if (constants_1.WN && constants_1.WN.storage) { | ||
constants_1.WN.storage.estimate().then(exports.reportStorageEstimate); | ||
} | ||
}; | ||
exports.reportStorageEstimate = function (storageInfo) { | ||
var estimateUsageDetails = {}; | ||
if ('usageDetails' in storageInfo) { | ||
estimateUsageDetails = storageInfo.usageDetails; | ||
} | ||
var estimateUsageDetails = 'usageDetails' in storageInfo ? storageInfo.usageDetails : {}; | ||
log_1.logData('storageEstimate', { | ||
@@ -23,0 +14,0 @@ quota: utils_1.convertToKB(storageInfo.quota), |
@@ -1,2 +0,2 @@ | ||
var n={t:!1,i:15e3},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},a=function(){return r.hardwareConcurrency},c=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},f="4g",s=!1,l=function(){return!!(a()&&a()<=4)||!!(u()&&u()<=4)},m=function(n,t){return!!l()||(!!["slow-2g","2g","3g"].includes(n)||!!t)},v={o:!1},d=function(n){i.hidden&&(n(),v.o=i.hidden)},p=function(t,e,i){v.o&&t.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:t,data:e,eventProperties:i||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:a()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(f,s)}:{}})},g=function(n){return parseFloat(n.toFixed(2))},k=function(n){return"number"!=typeof n?null:g(n/Math.pow(1024,2))},T=function(n){"requestIdleCallback"in t?t.requestIdleCallback(n,{timeout:3e3}):n()},b=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=g(t[n]))})),T((function(){p(n,t,e)}))},h=function(t,e){var i=g(t);i>n.i||i<=0||T((function(){p(e,i)}))},_=function(n){return o.measure(n,"mark_"+n+"_start","mark_"+n+"_end"),function(n){var t=o.getEntriesByName(n),e=t[t.length-1];return e&&"measure"===e.entryType?e.duration:-1}(n)},w={},y={value:0},x={value:0},F={value:0},D={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},E={value:0},P=function(n){var t=n.pop();t&&!t.u&&t.value&&(y.value+=t.value)},S={},j=function(n){var t=n.pop();t&&h(t.duration,"fid"),S.s.disconnect(),S.l&&h(F.value,"lcp"),S.m&&(S.m.takeRecords(),h(y.value,"cls")),S.v&&h(E.value,"tbt"),setTimeout((function(){S.v&&h(E.value,"tbt5S")}),5e3),setTimeout((function(){S.v&&(h(E.value,"tbt10S"),S.v.disconnect()),b("dataConsumption",D.value)}),1e4)},q=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},C=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<x.value)){var t=n.duration-50;t>0&&(E.value+=t)}}))},I=function(n){n.forEach((function(n){"first-paint"===n.name?h(n.startTime,"fp"):"first-contentful-paint"===n.name&&h(n.startTime,"fcp"),"first-contentful-paint"===n.name&&(x.value=n.startTime,S.v=q("longtask",C),S.p.disconnect())}))},L=function(n){var t=n.pop();t&&(F.value=t.renderTime||t.loadTime)},O=function(t){t.forEach((function(t){if(n.t&&b("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;D.value[t.initiatorType]+=e,D.value.total+=e}}))},W=function(){S.l&&(h(F.value,"lcpFinal"),S.l.disconnect()),S.m&&(S.m.takeRecords(),h(y.value,"clsFinal"),S.m.disconnect())},B=function(n){var t={};"usageDetails"in n&&(t=n.usageDetails),b("storageEstimate",{quota:k(n.quota),usage:k(n.usage),caches:k(t.caches),indexedDB:k(t.indexedDB),serviceWorker:k(t.serviceWorkerRegistrations)})},M=function(){function e(e){void 0===e&&(e={}),n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=e.maxMeasureTime||n.i,c()&&("PerformanceObserver"in t&&(S.p=q("paint",I),S.s=q("first-input",j),S.l=q("largest-contentful-paint",L),n.t&&q("resource",O),S.m=q("layout-shift",P)),function(n){void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,n))}(W),b("navigationTiming",function(){if(!c())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}()),b("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(f=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(B))}return e.prototype.start=function(n){c()&&!w[n]&&(w[n]=!0,o.mark("mark_"+n+"_start"),v.o=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),c()&&w[n]&&(o.mark("mark_"+n+"_end"),delete w[n],b(n,{data:g(_(n))},t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete w[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}();export default M; | ||
var n={t:!1,i:15e3},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},a=function(){return r.hardwareConcurrency},c=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},f="4g",s=!1,l=function(){return!!(a()&&a()<=4)||!!(u()&&u()<=4)},m=function(n,t){return!!l()||(!!["slow-2g","2g","3g"].includes(n)||!!t)},v={o:!1},d=function(n){i.hidden&&(n(),v.o=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},g=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},k=function(e,i,o){var c;c=function(){v.o&&e.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:e,data:i,eventProperties:o||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:a()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(f,s)}:{}})},"requestIdleCallback"in t?t.requestIdleCallback(c,{timeout:3e3}):c()},T=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),k(n,t,e)},b=function(t,e){var i=p(t);i<=n.i&&i>0&&k(e,i)},h=function(n){o.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var t=o.getEntriesByName(n).pop();return t&&"measure"===t.entryType?t.duration:-1},_={},w={value:0},y={value:0},x={value:0},F={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},D={value:0},E=function(n){var t=n.pop();t&&!t.u&&t.value&&(w.value+=t.value)},P={},S=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},j=function(n){P[n].disconnect(),delete P[n]},q=function(n){var t=n.pop();t&&b(t.duration,"fid"),j(1),P[2]&&b(x.value,"lcp"),P[3]&&(P[3].takeRecords(),b(w.value,"cls")),P[4]&&(b(D.value,"tbt"),setTimeout((function(){b(D.value,"tbt5S")}),5e3)),setTimeout((function(){P[4]&&(b(D.value,"tbt10S"),j(4)),T("dataConsumption",F.value)}),1e4)},C=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<y.value)){var t=n.duration-50;t>0&&(D.value+=t)}}))},I=function(n){n.forEach((function(n){"first-paint"===n.name?b(n.startTime,"fp"):"first-contentful-paint"===n.name&&(y.value=n.startTime,b(y.value,"fcp"),P[4]=S("longtask",C),j(0))}))},L=function(n){var t=n.pop();t&&(x.value=t.renderTime||t.loadTime)},O=function(t){t.forEach((function(t){if(n.t&&T("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;F.value[t.initiatorType]+=e,F.value.total+=e}}))},W=function(){P[2]&&(b(x.value,"lcpFinal"),j(2)),P[3]&&(P[3].takeRecords(),b(w.value,"clsFinal"),j(3))},B=function(n){var t="usageDetails"in n?n.usageDetails:{};T("storageEstimate",{quota:g(n.quota),usage:g(n.usage),caches:g(t.caches),indexedDB:g(t.indexedDB),serviceWorker:g(t.serviceWorkerRegistrations)})},M=function(){function e(e){void 0===e&&(e={}),n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=e.maxMeasureTime||n.i,c()&&("PerformanceObserver"in t&&(P[0]=S("paint",I),P[1]=S("first-input",q),P[2]=S("largest-contentful-paint",L),n.t&&S("resource",O),P[3]=S("layout-shift",E)),function(n){void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,n))}(W),T("navigationTiming",function(){if(!c())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}()),T("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(f=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(B))}return e.prototype.start=function(n){c()&&!_[n]&&(_[n]=!0,o.mark("mark_"+n+"_start"),v.o=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),c()&&_[n]&&(o.mark("mark_"+n+"_end"),delete _[n],T(n,{data:p(h(n))},t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete _[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}();export default M; | ||
//# sourceMappingURL=perfume.esm.min.js.map |
@@ -1,2 +0,2 @@ | ||
var Perfume=function(){"use strict";var n={t:!1,i:15e3},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},a=function(){return r.hardwareConcurrency},c=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},f="4g",s=!1,l=function(){return!!(a()&&a()<=4)||!!(u()&&u()<=4)},m=function(n,t){return!!l()||(!!["slow-2g","2g","3g"].includes(n)||!!t)},v={o:!1},d=function(n){i.hidden&&(n(),v.o=i.hidden)},p=function(t,e,i){v.o&&t.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:t,data:e,eventProperties:i||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:a()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(f,s)}:{}})},g=function(n){return parseFloat(n.toFixed(2))},k=function(n){return"number"!=typeof n?null:g(n/Math.pow(1024,2))},T=function(n){"requestIdleCallback"in t?t.requestIdleCallback(n,{timeout:3e3}):n()},b=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=g(t[n]))})),T((function(){p(n,t,e)}))},h=function(t,e){var i=g(t);i>n.i||i<=0||T((function(){p(e,i)}))},_=function(n){return o.measure(n,"mark_"+n+"_start","mark_"+n+"_end"),function(n){var t=o.getEntriesByName(n),e=t[t.length-1];return e&&"measure"===e.entryType?e.duration:-1}(n)},w={},y={value:0},F={value:0},P={value:0},x={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},D={value:0},E=function(n){var t=n.pop();t&&!t.u&&t.value&&(y.value+=t.value)},S={},j=function(n){var t=n.pop();t&&h(t.duration,"fid"),S.s.disconnect(),S.l&&h(P.value,"lcp"),S.m&&(S.m.takeRecords(),h(y.value,"cls")),S.v&&h(D.value,"tbt"),setTimeout((function(){S.v&&h(D.value,"tbt5S")}),5e3),setTimeout((function(){S.v&&(h(D.value,"tbt10S"),S.v.disconnect()),b("dataConsumption",x.value)}),1e4)},q=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},C=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<F.value)){var t=n.duration-50;t>0&&(D.value+=t)}}))},I=function(n){n.forEach((function(n){"first-paint"===n.name?h(n.startTime,"fp"):"first-contentful-paint"===n.name&&h(n.startTime,"fcp"),"first-contentful-paint"===n.name&&(F.value=n.startTime,S.v=q("longtask",C),S.p.disconnect())}))},L=function(n){var t=n.pop();t&&(P.value=t.renderTime||t.loadTime)},O=function(t){t.forEach((function(t){if(n.t&&b("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;x.value[t.initiatorType]+=e,x.value.total+=e}}))},W=function(){S.l&&(h(P.value,"lcpFinal"),S.l.disconnect()),S.m&&(S.m.takeRecords(),h(y.value,"clsFinal"),S.m.disconnect())},B=function(n){var t={};"usageDetails"in n&&(t=n.usageDetails),b("storageEstimate",{quota:k(n.quota),usage:k(n.usage),caches:k(t.caches),indexedDB:k(t.indexedDB),serviceWorker:k(t.serviceWorkerRegistrations)})};return function(){function e(e){void 0===e&&(e={}),n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=e.maxMeasureTime||n.i,c()&&("PerformanceObserver"in t&&(S.p=q("paint",I),S.s=q("first-input",j),S.l=q("largest-contentful-paint",L),n.t&&q("resource",O),S.m=q("layout-shift",E)),function(n){void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,n))}(W),b("navigationTiming",function(){if(!c())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}()),b("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(f=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(B))}return e.prototype.start=function(n){c()&&!w[n]&&(w[n]=!0,o.mark("mark_"+n+"_start"),v.o=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),c()&&w[n]&&(o.mark("mark_"+n+"_end"),delete w[n],b(n,{data:g(_(n))},t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete w[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}()}(); | ||
var Perfume=function(){"use strict";var n={t:!1,i:15e3},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},a=function(){return r.hardwareConcurrency},c=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},f="4g",s=!1,l=function(){return!!(a()&&a()<=4)||!!(u()&&u()<=4)},m=function(n,t){return!!l()||(!!["slow-2g","2g","3g"].includes(n)||!!t)},v={o:!1},d=function(n){i.hidden&&(n(),v.o=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},g=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},k=function(e,i,o){var c;c=function(){v.o&&e.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:e,data:i,eventProperties:o||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:a()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:m(f,s)}:{}})},"requestIdleCallback"in t?t.requestIdleCallback(c,{timeout:3e3}):c()},T=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=p(t[n]))})),k(n,t,e)},b=function(t,e){var i=p(t);i<=n.i&&i>0&&k(e,i)},h=function(n){o.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var t=o.getEntriesByName(n).pop();return t&&"measure"===t.entryType?t.duration:-1},_={},w={value:0},y={value:0},F={value:0},P={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},x={value:0},D=function(n){var t=n.pop();t&&!t.u&&t.value&&(w.value+=t.value)},E={},S=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},j=function(n){E[n].disconnect(),delete E[n]},q=function(n){var t=n.pop();t&&b(t.duration,"fid"),j(1),E[2]&&b(F.value,"lcp"),E[3]&&(E[3].takeRecords(),b(w.value,"cls")),E[4]&&(b(x.value,"tbt"),setTimeout((function(){b(x.value,"tbt5S")}),5e3)),setTimeout((function(){E[4]&&(b(x.value,"tbt10S"),j(4)),T("dataConsumption",P.value)}),1e4)},C=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<y.value)){var t=n.duration-50;t>0&&(x.value+=t)}}))},I=function(n){n.forEach((function(n){"first-paint"===n.name?b(n.startTime,"fp"):"first-contentful-paint"===n.name&&(y.value=n.startTime,b(y.value,"fcp"),E[4]=S("longtask",C),j(0))}))},L=function(n){var t=n.pop();t&&(F.value=t.renderTime||t.loadTime)},O=function(t){t.forEach((function(t){if(n.t&&T("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;P.value[t.initiatorType]+=e,P.value.total+=e}}))},W=function(){E[2]&&(b(F.value,"lcpFinal"),j(2)),E[3]&&(E[3].takeRecords(),b(w.value,"clsFinal"),j(3))},B=function(n){var t="usageDetails"in n?n.usageDetails:{};T("storageEstimate",{quota:g(n.quota),usage:g(n.usage),caches:g(t.caches),indexedDB:g(t.indexedDB),serviceWorker:g(t.serviceWorkerRegistrations)})};return function(){function e(e){void 0===e&&(e={}),n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=e.maxMeasureTime||n.i,c()&&("PerformanceObserver"in t&&(E[0]=S("paint",I),E[1]=S("first-input",q),E[2]=S("largest-contentful-paint",L),n.t&&S("resource",O),E[3]=S("layout-shift",D)),function(n){void 0!==i.hidden&&i.addEventListener("visibilitychange",d.bind(this,n))}(W),T("navigationTiming",function(){if(!c())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}()),T("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(f=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(B))}return e.prototype.start=function(n){c()&&!_[n]&&(_[n]=!0,o.mark("mark_"+n+"_start"),v.o=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),c()&&_[n]&&(o.mark("mark_"+n+"_end"),delete _[n],T(n,{data:p(h(n))},t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete _[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}()}(); | ||
//# sourceMappingURL=perfume.iife.min.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var config={t:!1,i:15e3},W=window,C=W.console,D=document,WN=W.navigator,WP=W.performance,getDM=function(){return WN.deviceMemory},getHC=function(){return WN.hardwareConcurrency},isPerformanceSupported=function(){return WP&&!!WP.getEntriesByType&&!!WP.now&&!!WP.mark},getNavigationTiming=function(){if(!isPerformanceSupported())return{};var e=WP.getEntriesByType("navigation")[0];if(!e)return{};var t=e.responseStart,r=e.responseEnd;return{fetchTime:r-e.fetchStart,workerTime:e.workerStart>0?r-e.workerStart:0,totalTime:r-e.requestStart,downloadTime:r-t,timeToFirstByte:t-e.requestStart,headerSize:e.transferSize-e.encodedBodySize||0,dnsLookupTime:e.domainLookupEnd-e.domainLookupStart}},et="4g",sd=!1,getNetworkInformation=function(){if("connection"in WN){var e=WN.connection;return"object"!=typeof e?{}:(et=e.effectiveType,sd=!!e.saveData,{downlink:e.downlink,effectiveType:e.effectiveType,rtt:e.rtt,saveData:!!e.saveData})}return{}},getIsLowEndDevice=function(){return!!(getHC()&&getHC()<=4)||!!(getDM()&&getDM()<=4)},getIsLowEndExperience=function(e,t){return!!getIsLowEndDevice()||(!!["slow-2g","2g","3g"].includes(e)||!!t)},getNavigatorInfo=function(){return WN?{deviceMemory:getDM()||0,hardwareConcurrency:getHC()||0,serviceWorkerStatus:"serviceWorker"in WN?WN.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:getIsLowEndDevice(),isLowEndExperience:getIsLowEndExperience(et,sd)}:{}},visibility={o:!1},onVisibilityChange=function(e){void 0!==D.hidden&&D.addEventListener("visibilitychange",didVisibilityChange.bind(this,e))},didVisibilityChange=function(e){D.hidden&&(e(),visibility.o=D.hidden)},reportPerf=function(e,t,r){visibility.o&&e.indexOf("Final")<0||!config.analyticsTracker||config.analyticsTracker({metricName:e,data:t,eventProperties:r||{},navigatorInformation:getNavigatorInfo()})},roundByTwo=function(e){return parseFloat(e.toFixed(2))},convertToKB=function(e){return"number"!=typeof e?null:roundByTwo(e/Math.pow(1024,2))},pushTask=function(e){"requestIdleCallback"in W?W.requestIdleCallback(e,{timeout:3e3}):e()},logData=function(e,t,r){Object.keys(t).forEach((function(e){"number"==typeof t[e]&&(t[e]=roundByTwo(t[e]))})),pushTask((function(){reportPerf(e,t,r)}))},logMetric=function(e,t){var r=roundByTwo(e);r>config.i||r<=0||pushTask((function(){reportPerf(t,r)}))},getDurationByMetric=function(e){var t=WP.getEntriesByName(e),r=t[t.length-1];return r&&"measure"===r.entryType?r.duration:-1},performanceMeasure=function(e){return WP.measure(e,"mark_"+e+"_start","mark_"+e+"_end"),getDurationByMetric(e)},metrics={},cls={value:0},clsMetricName="cls",fcp={value:0},lcp={value:0},fcpEntryName="first-contentful-paint",lcpMetricName="lcp",rt={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},tbt={value:0},tbtMetricName="tbt",initLayoutShift=function(e){var t=e.pop();t&&!t.s&&t.value&&(cls.value+=t.value)},perfObservers={},initFirstInputDelay=function(e){var t=e.pop();t&&logMetric(t.duration,"fid"),perfObservers.u.disconnect(),perfObservers.p&&logMetric(lcp.value,lcpMetricName),perfObservers.g&&(perfObservers.g.takeRecords(),logMetric(cls.value,clsMetricName)),perfObservers.l&&logMetric(tbt.value,tbtMetricName),setTimeout((function(){perfObservers.l&&logMetric(tbt.value,tbtMetricName+"5S")}),5e3),setTimeout((function(){perfObservers.l&&(logMetric(tbt.value,tbtMetricName+"10S"),perfObservers.l.disconnect()),logData("dataConsumption",rt.value)}),1e4)},po=function(e,t){try{var r=new PerformanceObserver((function(e){t(e.getEntries())}));return r.observe({type:e,buffered:!0}),r}catch(e){C.warn("Perfume.js:",e)}return null},initTotalBlockingTime=function(e){e.forEach((function(e){if(!("self"!==e.name||e.startTime<fcp.value)){var t=e.duration-50;t>0&&(tbt.value+=t)}}))},initFirstPaint=function(e){e.forEach((function(e){"first-paint"===e.name?logMetric(e.startTime,"fp"):e.name===fcpEntryName&&logMetric(e.startTime,"fcp"),e.name===fcpEntryName&&(fcp.value=e.startTime,perfObservers.l=po("longtask",initTotalBlockingTime),perfObservers.m.disconnect())}))},initLargestContentfulPaint=function(e){var t=e.pop();t&&(lcp.value=t.renderTime||t.loadTime)},initResourceTiming=function(e){e.forEach((function(e){if(config.t&&logData("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;rt.value[e.initiatorType]+=t,rt.value.total+=t}}))},initPerformanceObserver=function(){perfObservers.m=po("paint",initFirstPaint),perfObservers.u=po("first-input",initFirstInputDelay),perfObservers.p=po("largest-contentful-paint",initLargestContentfulPaint),config.t&&po("resource",initResourceTiming),perfObservers.g=po("layout-shift",initLayoutShift)},disconnectPerfObserversHidden=function(){perfObservers.p&&(logMetric(lcp.value,lcpMetricName+"Final"),perfObservers.p.disconnect()),perfObservers.g&&(perfObservers.g.takeRecords(),logMetric(cls.value,clsMetricName+"Final"),perfObservers.g.disconnect())},initStorageEstimate=function(){WN&&WN.storage&&WN.storage.estimate().then(reportStorageEstimate)},reportStorageEstimate=function(e){var t={};"usageDetails"in e&&(t=e.usageDetails),logData("storageEstimate",{quota:convertToKB(e.quota),usage:convertToKB(e.usage),caches:convertToKB(t.caches),indexedDB:convertToKB(t.indexedDB),serviceWorker:convertToKB(t.serviceWorkerRegistrations)})},Perfume=function(){function e(e){void 0===e&&(e={}),config.analyticsTracker=e.analyticsTracker,config.t=!!e.resourceTiming,config.i=e.maxMeasureTime||config.i,isPerformanceSupported()&&("PerformanceObserver"in W&&initPerformanceObserver(),onVisibilityChange(disconnectPerfObserversHidden),logData("navigationTiming",getNavigationTiming()),logData("networkInformation",getNetworkInformation()),initStorageEstimate())}return e.prototype.start=function(e){isPerformanceSupported()&&!metrics[e]&&(metrics[e]=!0,WP.mark("mark_"+e+"_start"),visibility.o=!1)},e.prototype.end=function(e,t){void 0===t&&(t={}),isPerformanceSupported()&&metrics[e]&&(WP.mark("mark_"+e+"_end"),delete metrics[e],logData(e,{data:roundByTwo(performanceMeasure(e))},t))},e.prototype.endPaint=function(e,t){var r=this;setTimeout((function(){r.end(e,t)}))},e.prototype.clear=function(e){delete metrics[e],WP.clearMarks&&(WP.clearMarks("mark_"+e+"_start"),WP.clearMarks("mark_"+e+"_end"))},e}();module.exports=Perfume; | ||
"use strict";var config={t:!1,i:15e3},W=window,C=W.console,D=document,WN=W.navigator,WP=W.performance,getDM=function(){return WN.deviceMemory},getHC=function(){return WN.hardwareConcurrency},isPerformanceSupported=function(){return WP&&!!WP.getEntriesByType&&!!WP.now&&!!WP.mark},getNavigationTiming=function(){if(!isPerformanceSupported())return{};var e=WP.getEntriesByType("navigation")[0];if(!e)return{};var t=e.responseStart,r=e.responseEnd;return{fetchTime:r-e.fetchStart,workerTime:e.workerStart>0?r-e.workerStart:0,totalTime:r-e.requestStart,downloadTime:r-t,timeToFirstByte:t-e.requestStart,headerSize:e.transferSize-e.encodedBodySize||0,dnsLookupTime:e.domainLookupEnd-e.domainLookupStart}},et="4g",sd=!1,getNetworkInformation=function(){if("connection"in WN){var e=WN.connection;return"object"!=typeof e?{}:(et=e.effectiveType,sd=!!e.saveData,{downlink:e.downlink,effectiveType:e.effectiveType,rtt:e.rtt,saveData:!!e.saveData})}return{}},getIsLowEndDevice=function(){return!!(getHC()&&getHC()<=4)||!!(getDM()&&getDM()<=4)},getIsLowEndExperience=function(e,t){return!!getIsLowEndDevice()||(!!["slow-2g","2g","3g"].includes(e)||!!t)},getNavigatorInfo=function(){return WN?{deviceMemory:getDM()||0,hardwareConcurrency:getHC()||0,serviceWorkerStatus:"serviceWorker"in WN?WN.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:getIsLowEndDevice(),isLowEndExperience:getIsLowEndExperience(et,sd)}:{}},visibility={o:!1},onVisibilityChange=function(e){void 0!==D.hidden&&D.addEventListener("visibilitychange",didVisibilityChange.bind(this,e))},didVisibilityChange=function(e){D.hidden&&(e(),visibility.o=D.hidden)},roundByTwo=function(e){return parseFloat(e.toFixed(2))},convertToKB=function(e){return"number"!=typeof e?null:roundByTwo(e/Math.pow(1024,2))},pushTask=function(e){"requestIdleCallback"in W?W.requestIdleCallback(e,{timeout:3e3}):e()},reportPerf=function(e,t,r){pushTask((function(){visibility.o&&e.indexOf("Final")<0||!config.analyticsTracker||config.analyticsTracker({metricName:e,data:t,eventProperties:r||{},navigatorInformation:getNavigatorInfo()})}))},logData=function(e,t,r){Object.keys(t).forEach((function(e){"number"==typeof t[e]&&(t[e]=roundByTwo(t[e]))})),reportPerf(e,t,r)},logMetric=function(e,t){var r=roundByTwo(e);r<=config.i&&r>0&&reportPerf(t,r)},performanceMeasure=function(e){WP.measure(e,"mark_"+e+"_start","mark_"+e+"_end");var t=WP.getEntriesByName(e).pop();return t&&"measure"===t.entryType?t.duration:-1},metrics={},cls={value:0},clsMetricName="cls",fcp={value:0},lcp={value:0},fcpEntryName="first-contentful-paint",lcpMetricName="lcp",rt={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},tbt={value:0},tbtMetricName="tbt",initLayoutShift=function(e){var t=e.pop();t&&!t.s&&t.value&&(cls.value+=t.value)},perfObservers={},po=function(e,t){try{var r=new PerformanceObserver((function(e){t(e.getEntries())}));return r.observe({type:e,buffered:!0}),r}catch(e){C.warn("Perfume.js:",e)}return null},poDisconnect=function(e){perfObservers[e].disconnect(),delete perfObservers[e]},initFirstInputDelay=function(e){var t=e.pop();t&&logMetric(t.duration,"fid"),poDisconnect(1),perfObservers[2]&&logMetric(lcp.value,lcpMetricName),perfObservers[3]&&(perfObservers[3].takeRecords(),logMetric(cls.value,clsMetricName)),perfObservers[4]&&(logMetric(tbt.value,tbtMetricName),setTimeout((function(){logMetric(tbt.value,tbtMetricName+"5S")}),5e3)),setTimeout((function(){perfObservers[4]&&(logMetric(tbt.value,tbtMetricName+"10S"),poDisconnect(4)),logData("dataConsumption",rt.value)}),1e4)},initTotalBlockingTime=function(e){e.forEach((function(e){if(!("self"!==e.name||e.startTime<fcp.value)){var t=e.duration-50;t>0&&(tbt.value+=t)}}))},initFirstPaint=function(e){e.forEach((function(e){"first-paint"===e.name?logMetric(e.startTime,"fp"):e.name===fcpEntryName&&(fcp.value=e.startTime,logMetric(fcp.value,"fcp"),perfObservers[4]=po("longtask",initTotalBlockingTime),poDisconnect(0))}))},initLargestContentfulPaint=function(e){var t=e.pop();t&&(lcp.value=t.renderTime||t.loadTime)},initResourceTiming=function(e){e.forEach((function(e){if(config.t&&logData("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;rt.value[e.initiatorType]+=t,rt.value.total+=t}}))},initPerformanceObserver=function(){perfObservers[0]=po("paint",initFirstPaint),perfObservers[1]=po("first-input",initFirstInputDelay),perfObservers[2]=po("largest-contentful-paint",initLargestContentfulPaint),config.t&&po("resource",initResourceTiming),perfObservers[3]=po("layout-shift",initLayoutShift)},disconnectPerfObserversHidden=function(){perfObservers[2]&&(logMetric(lcp.value,lcpMetricName+"Final"),poDisconnect(2)),perfObservers[3]&&(perfObservers[3].takeRecords(),logMetric(cls.value,clsMetricName+"Final"),poDisconnect(3))},reportStorageEstimate=function(e){var t="usageDetails"in e?e.usageDetails:{};logData("storageEstimate",{quota:convertToKB(e.quota),usage:convertToKB(e.usage),caches:convertToKB(t.caches),indexedDB:convertToKB(t.indexedDB),serviceWorker:convertToKB(t.serviceWorkerRegistrations)})},Perfume=function(){function e(e){void 0===e&&(e={}),config.analyticsTracker=e.analyticsTracker,config.t=!!e.resourceTiming,config.i=e.maxMeasureTime||config.i,isPerformanceSupported()&&("PerformanceObserver"in W&&initPerformanceObserver(),onVisibilityChange(disconnectPerfObserversHidden),logData("navigationTiming",getNavigationTiming()),logData("networkInformation",getNetworkInformation()),WN&&WN.storage&&WN.storage.estimate().then(reportStorageEstimate))}return e.prototype.start=function(e){isPerformanceSupported()&&!metrics[e]&&(metrics[e]=!0,WP.mark("mark_"+e+"_start"),visibility.o=!1)},e.prototype.end=function(e,t){void 0===t&&(t={}),isPerformanceSupported()&&metrics[e]&&(WP.mark("mark_"+e+"_end"),delete metrics[e],logData(e,{data:roundByTwo(performanceMeasure(e))},t))},e.prototype.endPaint=function(e,t){var r=this;setTimeout((function(){r.end(e,t)}))},e.prototype.clear=function(e){delete metrics[e],WP.clearMarks&&(WP.clearMarks("mark_"+e+"_start"),WP.clearMarks("mark_"+e+"_end"))},e}();module.exports=Perfume; | ||
//# sourceMappingURL=perfume.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n=n||self).Perfume=t()}(this,(function(){"use strict";var n={t:!1,i:15e3},t=window,e=t.console,i=document,r=t.navigator,o=t.performance,u=function(){return r.deviceMemory},c=function(){return r.hardwareConcurrency},f=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},a="4g",s=!1,l=function(){return!!(c()&&c()<=4)||!!(u()&&u()<=4)},d=function(n,t){return!!l()||(!!["slow-2g","2g","3g"].includes(n)||!!t)},m={o:!1},v=function(n){i.hidden&&(n(),m.o=i.hidden)},p=function(t,e,i){m.o&&t.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:t,data:e,eventProperties:i||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:c()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:d(a,s)}:{}})},g=function(n){return parseFloat(n.toFixed(2))},k=function(n){return"number"!=typeof n?null:g(n/Math.pow(1024,2))},b=function(n){"requestIdleCallback"in t?t.requestIdleCallback(n,{timeout:3e3}):n()},h=function(n,t,e){Object.keys(t).forEach((function(n){"number"==typeof t[n]&&(t[n]=g(t[n]))})),b((function(){p(n,t,e)}))},y=function(t,e){var i=g(t);i>n.i||i<=0||b((function(){p(e,i)}))},T=function(n){return o.measure(n,"mark_"+n+"_start","mark_"+n+"_end"),function(n){var t=o.getEntriesByName(n),e=t[t.length-1];return e&&"measure"===e.entryType?e.duration:-1}(n)},_={},w={value:0},x={value:0},F={value:0},j={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},D={value:0},E=function(n){var t=n.pop();t&&!t.u&&t.value&&(w.value+=t.value)},P={},S=function(n){var t=n.pop();t&&y(t.duration,"fid"),P.s.disconnect(),P.l&&y(F.value,"lcp"),P.m&&(P.m.takeRecords(),y(w.value,"cls")),P.v&&y(D.value,"tbt"),setTimeout((function(){P.v&&y(D.value,"tbt5S")}),5e3),setTimeout((function(){P.v&&(y(D.value,"tbt10S"),P.v.disconnect()),h("dataConsumption",j.value)}),1e4)},q=function(n,t){try{var i=new PerformanceObserver((function(n){t(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){e.warn("Perfume.js:",n)}return null},C=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<x.value)){var t=n.duration-50;t>0&&(D.value+=t)}}))},I=function(n){n.forEach((function(n){"first-paint"===n.name?y(n.startTime,"fp"):"first-contentful-paint"===n.name&&y(n.startTime,"fcp"),"first-contentful-paint"===n.name&&(x.value=n.startTime,P.v=q("longtask",C),P.p.disconnect())}))},L=function(n){var t=n.pop();t&&(F.value=t.renderTime||t.loadTime)},O=function(t){t.forEach((function(t){if(n.t&&h("resourceTiming",t),t.decodedBodySize&&t.initiatorType){var e=t.decodedBodySize/1e3;j.value[t.initiatorType]+=e,j.value.total+=e}}))},W=function(){P.l&&(y(F.value,"lcpFinal"),P.l.disconnect()),P.m&&(P.m.takeRecords(),y(w.value,"clsFinal"),P.m.disconnect())},B=function(n){var t={};"usageDetails"in n&&(t=n.usageDetails),h("storageEstimate",{quota:k(n.quota),usage:k(n.usage),caches:k(t.caches),indexedDB:k(t.indexedDB),serviceWorker:k(t.serviceWorkerRegistrations)})};return function(){function e(e){void 0===e&&(e={}),n.analyticsTracker=e.analyticsTracker,n.t=!!e.resourceTiming,n.i=e.maxMeasureTime||n.i,f()&&("PerformanceObserver"in t&&(P.p=q("paint",I),P.s=q("first-input",S),P.l=q("largest-contentful-paint",L),n.t&&q("resource",O),P.m=q("layout-shift",E)),function(n){void 0!==i.hidden&&i.addEventListener("visibilitychange",v.bind(this,n))}(W),h("navigationTiming",function(){if(!f())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var t=n.responseStart,e=n.responseEnd;return{fetchTime:e-n.fetchStart,workerTime:n.workerStart>0?e-n.workerStart:0,totalTime:e-n.requestStart,downloadTime:e-t,timeToFirstByte:t-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}()),h("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(a=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(B))}return e.prototype.start=function(n){f()&&!_[n]&&(_[n]=!0,o.mark("mark_"+n+"_start"),m.o=!1)},e.prototype.end=function(n,t){void 0===t&&(t={}),f()&&_[n]&&(o.mark("mark_"+n+"_end"),delete _[n],h(n,{data:g(T(n))},t))},e.prototype.endPaint=function(n,t){var e=this;setTimeout((function(){e.end(n,t)}))},e.prototype.clear=function(n){delete _[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},e}()})); | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(n=n||self).Perfume=e()}(this,(function(){"use strict";var n={t:!1,i:15e3},e=window,t=e.console,i=document,r=e.navigator,o=e.performance,u=function(){return r.deviceMemory},c=function(){return r.hardwareConcurrency},a=function(){return o&&!!o.getEntriesByType&&!!o.now&&!!o.mark},f="4g",s=!1,l=function(){return!!(c()&&c()<=4)||!!(u()&&u()<=4)},d=function(n,e){return!!l()||(!!["slow-2g","2g","3g"].includes(n)||!!e)},m={o:!1},v=function(n){i.hidden&&(n(),m.o=i.hidden)},p=function(n){return parseFloat(n.toFixed(2))},g=function(n){return"number"!=typeof n?null:p(n/Math.pow(1024,2))},k=function(t,i,o){var a;a=function(){m.o&&t.indexOf("Final")<0||!n.analyticsTracker||n.analyticsTracker({metricName:t,data:i,eventProperties:o||{},navigatorInformation:r?{deviceMemory:u()||0,hardwareConcurrency:c()||0,serviceWorkerStatus:"serviceWorker"in r?r.serviceWorker.controller?"controlled":"supported":"unsupported",isLowEndDevice:l(),isLowEndExperience:d(f,s)}:{}})},"requestIdleCallback"in e?e.requestIdleCallback(a,{timeout:3e3}):a()},b=function(n,e,t){Object.keys(e).forEach((function(n){"number"==typeof e[n]&&(e[n]=p(e[n]))})),k(n,e,t)},h=function(e,t){var i=p(e);i<=n.i&&i>0&&k(t,i)},y=function(n){o.measure(n,"mark_"+n+"_start","mark_"+n+"_end");var e=o.getEntriesByName(n).pop();return e&&"measure"===e.entryType?e.duration:-1},T={},_={value:0},w={value:0},x={value:0},F={value:{beacon:0,css:0,fetch:0,img:0,other:0,script:0,total:0,xmlhttprequest:0}},j={value:0},D=function(n){var e=n.pop();e&&!e.u&&e.value&&(_.value+=e.value)},E={},P=function(n,e){try{var i=new PerformanceObserver((function(n){e(n.getEntries())}));return i.observe({type:n,buffered:!0}),i}catch(n){t.warn("Perfume.js:",n)}return null},S=function(n){E[n].disconnect(),delete E[n]},q=function(n){var e=n.pop();e&&h(e.duration,"fid"),S(1),E[2]&&h(x.value,"lcp"),E[3]&&(E[3].takeRecords(),h(_.value,"cls")),E[4]&&(h(j.value,"tbt"),setTimeout((function(){h(j.value,"tbt5S")}),5e3)),setTimeout((function(){E[4]&&(h(j.value,"tbt10S"),S(4)),b("dataConsumption",F.value)}),1e4)},C=function(n){n.forEach((function(n){if(!("self"!==n.name||n.startTime<w.value)){var e=n.duration-50;e>0&&(j.value+=e)}}))},I=function(n){n.forEach((function(n){"first-paint"===n.name?h(n.startTime,"fp"):"first-contentful-paint"===n.name&&(w.value=n.startTime,h(w.value,"fcp"),E[4]=P("longtask",C),S(0))}))},L=function(n){var e=n.pop();e&&(x.value=e.renderTime||e.loadTime)},O=function(e){e.forEach((function(e){if(n.t&&b("resourceTiming",e),e.decodedBodySize&&e.initiatorType){var t=e.decodedBodySize/1e3;F.value[e.initiatorType]+=t,F.value.total+=t}}))},W=function(){E[2]&&(h(x.value,"lcpFinal"),S(2)),E[3]&&(E[3].takeRecords(),h(_.value,"clsFinal"),S(3))},B=function(n){var e="usageDetails"in n?n.usageDetails:{};b("storageEstimate",{quota:g(n.quota),usage:g(n.usage),caches:g(e.caches),indexedDB:g(e.indexedDB),serviceWorker:g(e.serviceWorkerRegistrations)})};return function(){function t(t){void 0===t&&(t={}),n.analyticsTracker=t.analyticsTracker,n.t=!!t.resourceTiming,n.i=t.maxMeasureTime||n.i,a()&&("PerformanceObserver"in e&&(E[0]=P("paint",I),E[1]=P("first-input",q),E[2]=P("largest-contentful-paint",L),n.t&&P("resource",O),E[3]=P("layout-shift",D)),function(n){void 0!==i.hidden&&i.addEventListener("visibilitychange",v.bind(this,n))}(W),b("navigationTiming",function(){if(!a())return{};var n=o.getEntriesByType("navigation")[0];if(!n)return{};var e=n.responseStart,t=n.responseEnd;return{fetchTime:t-n.fetchStart,workerTime:n.workerStart>0?t-n.workerStart:0,totalTime:t-n.requestStart,downloadTime:t-e,timeToFirstByte:e-n.requestStart,headerSize:n.transferSize-n.encodedBodySize||0,dnsLookupTime:n.domainLookupEnd-n.domainLookupStart}}()),b("networkInformation",function(){if("connection"in r){var n=r.connection;return"object"!=typeof n?{}:(f=n.effectiveType,s=!!n.saveData,{downlink:n.downlink,effectiveType:n.effectiveType,rtt:n.rtt,saveData:!!n.saveData})}return{}}()),r&&r.storage&&r.storage.estimate().then(B))}return t.prototype.start=function(n){a()&&!T[n]&&(T[n]=!0,o.mark("mark_"+n+"_start"),m.o=!1)},t.prototype.end=function(n,e){void 0===e&&(e={}),a()&&T[n]&&(o.mark("mark_"+n+"_end"),delete T[n],b(n,{data:p(y(n))},e))},t.prototype.endPaint=function(n,e){var t=this;setTimeout((function(){t.end(n,e)}))},t.prototype.clear=function(n){delete T[n],o.clearMarks&&(o.clearMarks("mark_"+n+"_start"),o.clearMarks("mark_"+n+"_end"))},t}()})); | ||
//# sourceMappingURL=perfume.umd.min.js.map |
/** | ||
* Get the duration of the timing metric or -1 if there a measurement has | ||
* not been made by the User Timing API | ||
* Get the duration of the timing metric or -1 | ||
* if there a measurement has not been made by the User Timing API | ||
*/ | ||
export declare const getDurationByMetric: (measureName: string) => number; | ||
export declare const performanceMeasure: (measureName: string) => number; |
@@ -7,1 +7,2 @@ import { IPerformanceObserverType } from './types'; | ||
export declare const po: (eventType: IPerformanceObserverType, cb: (performanceEntries: any[]) => void) => PerformanceObserver | null; | ||
export declare const poDisconnect: (observer: any) => void; |
@@ -6,3 +6,2 @@ /** | ||
*/ | ||
export declare const initStorageEstimate: () => void; | ||
export declare const reportStorageEstimate: (storageInfo: StorageEstimate) => void; |
{ | ||
"name": "perfume.js", | ||
"version": "5.0.0-rc.15", | ||
"description": "Tiny web performance monitoring library which reports field data back to your favorite analytics tool.", | ||
"version": "5.0.0-rc.16", | ||
"description": "Web performance library for measuring all User-centric performance metrics.", | ||
"keywords": [ | ||
@@ -91,6 +91,6 @@ "performance", | ||
"global": { | ||
"branches": 83, | ||
"functions": 93, | ||
"lines": 93, | ||
"statements": 93 | ||
"branches": 92, | ||
"functions": 94, | ||
"lines": 94, | ||
"statements": 94 | ||
} | ||
@@ -97,0 +97,0 @@ }, |
@@ -76,6 +76,8 @@ <a href="http://www.perfumejs.com/"> | ||
🚀 Visit [perfumejs.com](http://perfumejs.com/) for a live demo on how the metrics work. 🌕 | ||
```javascript | ||
const perfume = new Perfume({ | ||
analyticsTracker: (options) => { | ||
const { metricName, data, navigatorInformation } = options; | ||
const { metricName, data, eventProperties, navigatorInformation } = options; | ||
switch (metricName) { | ||
@@ -96,6 +98,6 @@ case 'navigationTiming': | ||
case 'fp': | ||
myAnalyticsTool.track('fp', { duration: data }); | ||
myAnalyticsTool.track('firstPaint', { duration: data }); | ||
break; | ||
case 'fcp': | ||
myAnalyticsTool.track('fcp', { duration: data }); | ||
myAnalyticsTool.track('firstContentfulPaint', { duration: data }); | ||
break; | ||
@@ -109,3 +111,3 @@ case 'fid': | ||
case 'lcpFinal': | ||
myAnalyticsTool.track('lcpFinal', { duration: data }); | ||
myAnalyticsTool.track('largestContentfulPaintFinal', { duration: data }); | ||
break; | ||
@@ -166,3 +168,3 @@ case 'cls': | ||
```javascript | ||
// Perfume.js: firstPaint 1482.00 ms | ||
// Perfume.js: fp 1482.00 ms | ||
``` | ||
@@ -169,0 +171,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
356
0.56%248403
-1.31%1453
-1.89%