perfume.js
Advanced tools
Comparing version
@@ -196,2 +196,7 @@ (function (global, factory) { | ||
// type ILogOptions = any; | ||
// type IPerfumeConfig = any; | ||
// type ISendTimingOptions = any; | ||
// import Perfume from '../../../../../dist/es/perfume' | ||
var PERFUME_CONFIG = new core.InjectionToken('Perfume.js config'); | ||
@@ -215,20 +220,3 @@ var PerfumeRootModule = /** @class */ (function () { | ||
function NgPerfume() { | ||
this.firstPaintDuration = 0; | ||
this.firstContentfulPaintDuration = 0; | ||
this.firstInputDelayDuration = 0; | ||
this.dataConsumption = 0; | ||
this.largestContentfulPaintDuration = 0; | ||
this.timeToInteractiveDuration = 0; | ||
this.config = exports.perfume.config; | ||
this.firstPaintDuration = exports.perfume.firstPaintDuration; | ||
this.firstContentfulPaintDuration = exports.perfume.firstContentfulPaintDuration; | ||
this.firstInputDelayDuration = exports.perfume.firstInputDelayDuration; | ||
this.largestContentfulPaintDuration = exports.perfume.largestContentfulPaintDuration; | ||
this.dataConsumption = exports.perfume.dataConsumption; | ||
this.observeFirstPaint = exports.perfume.observeFirstPaint; | ||
this.observeFirstContentfulPaint = exports.perfume.observeFirstContentfulPaint; | ||
this.observeFirstInputDelay = exports.perfume.observeFirstInputDelay; | ||
this.observeLargestContentfulPaint = exports.perfume.observeLargestContentfulPaint; | ||
this.observeTimeToInteractive = exports.perfume.observeTimeToInteractive; | ||
this.timeToInteractiveDuration = exports.perfume.timeToInteractiveDuration; | ||
} | ||
@@ -251,8 +239,2 @@ Object.defineProperty(NgPerfume.prototype, "navigationTiming", { | ||
}; | ||
NgPerfume.prototype.log = function (options) { | ||
exports.perfume.log(options); | ||
}; | ||
NgPerfume.prototype.sendTiming = function (options) { | ||
exports.perfume.sendTiming(options); | ||
}; | ||
NgPerfume = __decorate([ | ||
@@ -259,0 +241,0 @@ core.Injectable(), |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("perfume.js")):"function"==typeof define&&define.amd?define("perfume.js/angular",["exports","@angular/core","perfume.js"],t):t(((e=e||self).perfume=e.perfume||{},e.perfume.js=e.perfume.js||{},e.perfume.js.angular={}),e.ng.core,e.Perfume)}(this,function(e,t,n){"use strict";n=n&&n.hasOwnProperty("default")?n.default:n;function r(e,t,n,r){var o,i=arguments.length,u=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,n,r);else for(var f=e.length-1;f>=0;f--)(o=e[f])&&(u=(i<3?o(u):i>3?o(t,n,u):o(t,n))||u);return i>3&&u&&Object.defineProperty(t,n,u),u}function o(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function i(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)u.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return u}function u(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(i(arguments[t]));return e}var f=new t.InjectionToken("Perfume.js config"),a=function(){function i(t){this.config=t,e.perfume=new n(t)}var u,a;return i.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[f]}]}]},i=r([t.NgModule({}),(u=0,a=t.Inject(f),function(e,t){a(e,t,u)}),o("design:paramtypes",[Object])],i)}(),p=function(){function n(){this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.dataConsumption=0,this.largestContentfulPaintDuration=0,this.timeToInteractiveDuration=0,this.config=e.perfume.config,this.firstPaintDuration=e.perfume.firstPaintDuration,this.firstContentfulPaintDuration=e.perfume.firstContentfulPaintDuration,this.firstInputDelayDuration=e.perfume.firstInputDelayDuration,this.largestContentfulPaintDuration=e.perfume.largestContentfulPaintDuration,this.dataConsumption=e.perfume.dataConsumption,this.observeFirstPaint=e.perfume.observeFirstPaint,this.observeFirstContentfulPaint=e.perfume.observeFirstContentfulPaint,this.observeFirstInputDelay=e.perfume.observeFirstInputDelay,this.observeLargestContentfulPaint=e.perfume.observeLargestContentfulPaint,this.observeTimeToInteractive=e.perfume.observeTimeToInteractive,this.timeToInteractiveDuration=e.perfume.timeToInteractiveDuration}return Object.defineProperty(n.prototype,"navigationTiming",{get:function(){return e.perfume.navigationTiming},enumerable:!0,configurable:!0}),n.prototype.start=function(t){e.perfume.start(t)},n.prototype.end=function(t){return e.perfume.end(t)},n.prototype.endPaint=function(t){return e.perfume.endPaint(t)},n.prototype.log=function(t){e.perfume.log(t)},n.prototype.sendTiming=function(t){e.perfume.sendTiming(t)},n=r([t.Injectable(),o("design:paramtypes",[])],n)}(),s=function(){function e(){}return e.forRoot=function(e){return{ngModule:a,providers:[{provide:f,useValue:e},p]}},e=r([t.NgModule({imports:[],declarations:[],exports:[]})],e)}();e.NgPerfume=p,e.PERFUME_CONFIG=f,e.PerfumeAfterViewInit=function(t){return function(n){var r=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];e.perfume.start(t||n.name);var i=function(){return n.apply(this,arguments)};return i.prototype=Object.create(n.prototype),new(i.bind.apply(i,u([void 0],r)))},o=n.prototype.ngAfterViewInit;return n.prototype.ngAfterViewInit=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];o&&o.apply(this,r),e.perfume.end(t||n.name)},r.prototype=Object.create(n.prototype),r}},e.PerfumeModule=s,e.PerfumeRootModule=a,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("perfume.js")):"function"==typeof define&&define.amd?define("perfume.js/angular",["exports","@angular/core","perfume.js"],t):t(((e=e||self).perfume=e.perfume||{},e.perfume.js=e.perfume.js||{},e.perfume.js.angular={}),e.ng.core,e.Perfume)}(this,function(e,t,r){"use strict";r=r&&r.hasOwnProperty("default")?r.default:r;function n(e,t,r,n){var o,f=arguments.length,u=f<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,t,r,n);else for(var i=e.length-1;i>=0;i--)(o=e[i])&&(u=(f<3?o(u):f>3?o(t,r,u):o(t,r))||u);return f>3&&u&&Object.defineProperty(t,r,u),u}function o(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function f(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,o,f=r.call(e),u=[];try{for(;(void 0===t||t-- >0)&&!(n=f.next()).done;)u.push(n.value)}catch(e){o={error:e}}finally{try{n&&!n.done&&(r=f.return)&&r.call(f)}finally{if(o)throw o.error}}return u}function u(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}var i=new t.InjectionToken("Perfume.js config"),c=function(){function f(t){this.config=t,e.perfume=new r(t)}var u,c;return f.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[i]}]}]},f=n([t.NgModule({}),(u=0,c=t.Inject(i),function(e,t){c(e,t,u)}),o("design:paramtypes",[Object])],f)}(),a=function(){function r(){this.config=e.perfume.config}return Object.defineProperty(r.prototype,"navigationTiming",{get:function(){return e.perfume.navigationTiming},enumerable:!0,configurable:!0}),r.prototype.start=function(t){e.perfume.start(t)},r.prototype.end=function(t){return e.perfume.end(t)},r.prototype.endPaint=function(t){return e.perfume.endPaint(t)},r=n([t.Injectable(),o("design:paramtypes",[])],r)}(),p=function(){function e(){}return e.forRoot=function(e){return{ngModule:c,providers:[{provide:i,useValue:e},a]}},e=n([t.NgModule({imports:[],declarations:[],exports:[]})],e)}();e.NgPerfume=a,e.PERFUME_CONFIG=i,e.PerfumeAfterViewInit=function(t){return function(r){var n=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];e.perfume.start(t||r.name);var f=function(){return r.apply(this,arguments)};return f.prototype=Object.create(r.prototype),new(f.bind.apply(f,u([void 0],n)))},o=r.prototype.ngAfterViewInit;return r.prototype.ngAfterViewInit=function(){for(var n=[],f=0;f<arguments.length;f++)n[f]=arguments[f];o&&o.apply(this,n),e.perfume.end(t||r.name)},n.prototype=Object.create(r.prototype),n}},e.PerfumeModule=p,e.PerfumeRootModule=c,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=perfume.js-angular.umd.min.js.map |
import * as tslib_1 from "tslib"; | ||
import { Inject, Injectable, InjectionToken, NgModule, } from '@angular/core'; | ||
import Perfume from 'perfume.js'; | ||
// type ILogOptions = any; | ||
// type IPerfumeConfig = any; | ||
// type ISendTimingOptions = any; | ||
// import Perfume from '../../../../../dist/es/perfume' | ||
export let perfume; | ||
@@ -23,20 +27,3 @@ export const PERFUME_CONFIG = new InjectionToken('Perfume.js config'); | ||
constructor() { | ||
this.firstPaintDuration = 0; | ||
this.firstContentfulPaintDuration = 0; | ||
this.firstInputDelayDuration = 0; | ||
this.dataConsumption = 0; | ||
this.largestContentfulPaintDuration = 0; | ||
this.timeToInteractiveDuration = 0; | ||
this.config = perfume.config; | ||
this.firstPaintDuration = perfume.firstPaintDuration; | ||
this.firstContentfulPaintDuration = perfume.firstContentfulPaintDuration; | ||
this.firstInputDelayDuration = perfume.firstInputDelayDuration; | ||
this.largestContentfulPaintDuration = perfume.largestContentfulPaintDuration; | ||
this.dataConsumption = perfume.dataConsumption; | ||
this.observeFirstPaint = perfume.observeFirstPaint; | ||
this.observeFirstContentfulPaint = perfume.observeFirstContentfulPaint; | ||
this.observeFirstInputDelay = perfume.observeFirstInputDelay; | ||
this.observeLargestContentfulPaint = perfume.observeLargestContentfulPaint; | ||
this.observeTimeToInteractive = perfume.observeTimeToInteractive; | ||
this.timeToInteractiveDuration = perfume.timeToInteractiveDuration; | ||
} | ||
@@ -55,8 +42,2 @@ get navigationTiming() { | ||
} | ||
log(options) { | ||
perfume.log(options); | ||
} | ||
sendTiming(options) { | ||
perfume.sendTiming(options);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 +0,1 @@ | ||
{"moduleName":null,"summaries":[{"symbol":{"__symbol":0,"members":[]},"metadata":{"__symbolic":"error","message":"Variable not initialized","fileName":"projects/perfume/src/lib/perfume.module.ts"}},{"symbol":{"__symbol":1,"members":[]},"metadata":{"__symbolic":"new","expression":{"__symbol":2,"members":[]},"arguments":["Perfume.js config"]}},{"symbol":{"__symbol":3,"members":[]},"metadata":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbol":4,"members":[]},"arguments":[{"__symbol":1,"members":[]}]}]],"parameters":[{"__symbol":5,"members":[]}]}]}},"type":{"summaryKind":2,"type":{"reference":{"__symbol":3,"members":[]},"diDeps":[{"isAttribute":false,"isHost":false,"isSelf":false,"isSkipSelf":false,"isOptional":false,"token":{"identifier":{"reference":{"__symbol":1,"members":[]}}}}],"lifecycleHooks":[]},"entryComponents":[],"providers":[],"modules":[{"reference":{"__symbol":3,"members":[]},"diDeps":[{"isAttribute":false,"isHost":false,"isSelf":false,"isSkipSelf":false,"isOptional":false,"token":{"identifier":{"reference":{"__symbol":1,"members":[]}}}}],"lifecycleHooks":[]}],"exportedDirectives":[],"exportedPipes":[]}},{"symbol":{"__symbol":6,"members":[]},"metadata":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor"}],"start":[{"__symbolic":"method"}],"end":[{"__symbolic":"method"}],"endPaint":[{"__symbolic":"method"}],"log":[{"__symbolic":"method"}],"sendTiming":[{"__symbolic":"method"}]}},"type":{"summaryKind":3,"type":{"reference":{"__symbol":6,"members":[]},"diDeps":[],"lifecycleHooks":[]}}},{"symbol":{"__symbol":7,"members":[]},"metadata":{"__symbolic":"class","statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbol":3,"members":[]},"providers":[{"provide":{"__symbol":1,"members":[]},"useValue":{"__symbolic":"reference","name":"config"}},{"__symbol":6,"members":[]}]}}}},"type":{"summaryKind":2,"type":{"reference":{"__symbol":7,"members":[]},"diDeps":[],"lifecycleHooks":[]},"entryComponents":[],"providers":[],"modules":[{"reference":{"__symbol":7,"members":[]},"diDeps":[],"lifecycleHooks":[]}],"exportedDirectives":[],"exportedPipes":[]}},{"symbol":{"__symbol":8,"members":[]},"metadata":{"__symbolic":"interface"}},{"symbol":{"__symbol":9,"members":[]},"metadata":{"__symbolic":"function","parameters":["targetName"],"value":{"__symbolic":"error","message":"Lambda not supported","fileName":"projects/perfume/src/lib/perfume.module.ts"}}}],"symbols":[{"__symbol":0,"name":"perfume","filePath":"./perfume.module"},{"__symbol":1,"name":"PERFUME_CONFIG","filePath":"./perfume.module"},{"__symbol":2,"name":"InjectionToken","filePath":"@angular/core"},{"__symbol":3,"name":"PerfumeRootModule","filePath":"./perfume.module"},{"__symbol":4,"name":"Inject","filePath":"@angular/core"},{"__symbol":5,"name":"IPerfumeConfig","filePath":"perfume.js"},{"__symbol":6,"name":"NgPerfume","filePath":"./perfume.module"},{"__symbol":7,"name":"PerfumeModule","filePath":"./perfume.module"},{"__symbol":8,"name":"AfterViewInitable","filePath":"./perfume.module"},{"__symbol":9,"name":"PerfumeAfterViewInit","filePath":"./perfume.module"}]} | ||
{"moduleName":null,"summaries":[{"symbol":{"__symbol":0,"members":[]},"metadata":{"__symbolic":"error","message":"Variable not initialized","fileName":"projects/perfume/src/lib/perfume.module.ts"}},{"symbol":{"__symbol":1,"members":[]},"metadata":{"__symbolic":"new","expression":{"__symbol":2,"members":[]},"arguments":["Perfume.js config"]}},{"symbol":{"__symbol":3,"members":[]},"metadata":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbol":4,"members":[]},"arguments":[{"__symbol":1,"members":[]}]}]],"parameters":[{"__symbol":5,"members":[]}]}]}},"type":{"summaryKind":2,"type":{"reference":{"__symbol":3,"members":[]},"diDeps":[{"isAttribute":false,"isHost":false,"isSelf":false,"isSkipSelf":false,"isOptional":false,"token":{"identifier":{"reference":{"__symbol":1,"members":[]}}}}],"lifecycleHooks":[]},"entryComponents":[],"providers":[],"modules":[{"reference":{"__symbol":3,"members":[]},"diDeps":[{"isAttribute":false,"isHost":false,"isSelf":false,"isSkipSelf":false,"isOptional":false,"token":{"identifier":{"reference":{"__symbol":1,"members":[]}}}}],"lifecycleHooks":[]}],"exportedDirectives":[],"exportedPipes":[]}},{"symbol":{"__symbol":6,"members":[]},"metadata":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor"}],"start":[{"__symbolic":"method"}],"end":[{"__symbolic":"method"}],"endPaint":[{"__symbolic":"method"}]}},"type":{"summaryKind":3,"type":{"reference":{"__symbol":6,"members":[]},"diDeps":[],"lifecycleHooks":[]}}},{"symbol":{"__symbol":7,"members":[]},"metadata":{"__symbolic":"class","statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbol":3,"members":[]},"providers":[{"provide":{"__symbol":1,"members":[]},"useValue":{"__symbolic":"reference","name":"config"}},{"__symbol":6,"members":[]}]}}}},"type":{"summaryKind":2,"type":{"reference":{"__symbol":7,"members":[]},"diDeps":[],"lifecycleHooks":[]},"entryComponents":[],"providers":[],"modules":[{"reference":{"__symbol":7,"members":[]},"diDeps":[],"lifecycleHooks":[]}],"exportedDirectives":[],"exportedPipes":[]}},{"symbol":{"__symbol":8,"members":[]},"metadata":{"__symbolic":"interface"}},{"symbol":{"__symbol":9,"members":[]},"metadata":{"__symbolic":"function","parameters":["targetName"],"value":{"__symbolic":"error","message":"Lambda not supported","fileName":"projects/perfume/src/lib/perfume.module.ts"}}}],"symbols":[{"__symbol":0,"name":"perfume","filePath":"./perfume.module"},{"__symbol":1,"name":"PERFUME_CONFIG","filePath":"./perfume.module"},{"__symbol":2,"name":"InjectionToken","filePath":"@angular/core"},{"__symbol":3,"name":"PerfumeRootModule","filePath":"./perfume.module"},{"__symbol":4,"name":"Inject","filePath":"@angular/core"},{"__symbol":5,"name":"IPerfumeConfig","filePath":"perfume.js"},{"__symbol":6,"name":"NgPerfume","filePath":"./perfume.module"},{"__symbol":7,"name":"PerfumeModule","filePath":"./perfume.module"},{"__symbol":8,"name":"AfterViewInitable","filePath":"./perfume.module"},{"__symbol":9,"name":"PerfumeAfterViewInit","filePath":"./perfume.module"}]} |
import * as tslib_1 from "tslib"; | ||
import { Inject, Injectable, InjectionToken, NgModule, } from '@angular/core'; | ||
import Perfume from 'perfume.js'; | ||
// type ILogOptions = any; | ||
// type IPerfumeConfig = any; | ||
// type ISendTimingOptions = any; | ||
// import Perfume from '../../../../../dist/es/perfume' | ||
export var perfume; | ||
@@ -24,20 +28,3 @@ export var PERFUME_CONFIG = new InjectionToken('Perfume.js config'); | ||
function NgPerfume() { | ||
this.firstPaintDuration = 0; | ||
this.firstContentfulPaintDuration = 0; | ||
this.firstInputDelayDuration = 0; | ||
this.dataConsumption = 0; | ||
this.largestContentfulPaintDuration = 0; | ||
this.timeToInteractiveDuration = 0; | ||
this.config = perfume.config; | ||
this.firstPaintDuration = perfume.firstPaintDuration; | ||
this.firstContentfulPaintDuration = perfume.firstContentfulPaintDuration; | ||
this.firstInputDelayDuration = perfume.firstInputDelayDuration; | ||
this.largestContentfulPaintDuration = perfume.largestContentfulPaintDuration; | ||
this.dataConsumption = perfume.dataConsumption; | ||
this.observeFirstPaint = perfume.observeFirstPaint; | ||
this.observeFirstContentfulPaint = perfume.observeFirstContentfulPaint; | ||
this.observeFirstInputDelay = perfume.observeFirstInputDelay; | ||
this.observeLargestContentfulPaint = perfume.observeLargestContentfulPaint; | ||
this.observeTimeToInteractive = perfume.observeTimeToInteractive; | ||
this.timeToInteractiveDuration = perfume.timeToInteractiveDuration; | ||
} | ||
@@ -60,8 +47,2 @@ Object.defineProperty(NgPerfume.prototype, "navigationTiming", { | ||
}; | ||
NgPerfume.prototype.log = function (options) { | ||
perfume.log(options); | ||
}; | ||
NgPerfume.prototype.sendTiming = function (options) { | ||
perfume.sendTiming(options); | ||
}; | ||
NgPerfume = tslib_1.__decorate([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25zdHJ1Y3Rvci5wcm90b3R5cGUgPSBPYmplY3QuY3JlYXRlKHRhcmdldC5wcm90b3R5cGUpO1xuXG4gICAgLy8gUmV0dXJuIG5ldyBjb25zdHJ1Y3RvciAod2lsbCBvdmVycmlkZSBvcmlnaW5hbClcbiAgICByZXR1cm4gbmV3Q29uc3RydWN0b3I7XG4gIH07XG59XG4iXX0= |
@@ -5,2 +5,6 @@ import { __decorate, __param, __metadata } from 'tslib'; | ||
// type ILogOptions = any; | ||
// type IPerfumeConfig = any; | ||
// type ISendTimingOptions = any; | ||
// import Perfume from '../../../../../dist/es/perfume' | ||
let perfume; | ||
@@ -24,20 +28,3 @@ const PERFUME_CONFIG = new InjectionToken('Perfume.js config'); | ||
constructor() { | ||
this.firstPaintDuration = 0; | ||
this.firstContentfulPaintDuration = 0; | ||
this.firstInputDelayDuration = 0; | ||
this.dataConsumption = 0; | ||
this.largestContentfulPaintDuration = 0; | ||
this.timeToInteractiveDuration = 0; | ||
this.config = perfume.config; | ||
this.firstPaintDuration = perfume.firstPaintDuration; | ||
this.firstContentfulPaintDuration = perfume.firstContentfulPaintDuration; | ||
this.firstInputDelayDuration = perfume.firstInputDelayDuration; | ||
this.largestContentfulPaintDuration = perfume.largestContentfulPaintDuration; | ||
this.dataConsumption = perfume.dataConsumption; | ||
this.observeFirstPaint = perfume.observeFirstPaint; | ||
this.observeFirstContentfulPaint = perfume.observeFirstContentfulPaint; | ||
this.observeFirstInputDelay = perfume.observeFirstInputDelay; | ||
this.observeLargestContentfulPaint = perfume.observeLargestContentfulPaint; | ||
this.observeTimeToInteractive = perfume.observeTimeToInteractive; | ||
this.timeToInteractiveDuration = perfume.timeToInteractiveDuration; | ||
} | ||
@@ -56,8 +43,2 @@ get navigationTiming() { | ||
} | ||
log(options) { | ||
perfume.log(options); | ||
} | ||
sendTiming(options) { | ||
perfume.sendTiming(options); | ||
} | ||
}; | ||
@@ -64,0 +45,0 @@ NgPerfume = __decorate([ |
@@ -5,2 +5,6 @@ import { __decorate, __param, __metadata, __spread } from 'tslib'; | ||
// type ILogOptions = any; | ||
// type IPerfumeConfig = any; | ||
// type ISendTimingOptions = any; | ||
// import Perfume from '../../../../../dist/es/perfume' | ||
var perfume; | ||
@@ -25,20 +29,3 @@ var PERFUME_CONFIG = new InjectionToken('Perfume.js config'); | ||
function NgPerfume() { | ||
this.firstPaintDuration = 0; | ||
this.firstContentfulPaintDuration = 0; | ||
this.firstInputDelayDuration = 0; | ||
this.dataConsumption = 0; | ||
this.largestContentfulPaintDuration = 0; | ||
this.timeToInteractiveDuration = 0; | ||
this.config = perfume.config; | ||
this.firstPaintDuration = perfume.firstPaintDuration; | ||
this.firstContentfulPaintDuration = perfume.firstContentfulPaintDuration; | ||
this.firstInputDelayDuration = perfume.firstInputDelayDuration; | ||
this.largestContentfulPaintDuration = perfume.largestContentfulPaintDuration; | ||
this.dataConsumption = perfume.dataConsumption; | ||
this.observeFirstPaint = perfume.observeFirstPaint; | ||
this.observeFirstContentfulPaint = perfume.observeFirstContentfulPaint; | ||
this.observeFirstInputDelay = perfume.observeFirstInputDelay; | ||
this.observeLargestContentfulPaint = perfume.observeLargestContentfulPaint; | ||
this.observeTimeToInteractive = perfume.observeTimeToInteractive; | ||
this.timeToInteractiveDuration = perfume.timeToInteractiveDuration; | ||
} | ||
@@ -61,8 +48,2 @@ Object.defineProperty(NgPerfume.prototype, "navigationTiming", { | ||
}; | ||
NgPerfume.prototype.log = function (options) { | ||
perfume.log(options); | ||
}; | ||
NgPerfume.prototype.sendTiming = function (options) { | ||
perfume.sendTiming(options); | ||
}; | ||
NgPerfume = __decorate([ | ||
@@ -69,0 +50,0 @@ Injectable(), |
import { AfterViewInit, InjectionToken, ModuleWithProviders } from '@angular/core'; | ||
import Perfume, { ILogOptions, IPerfumeConfig, ISendTimingOptions } from 'perfume.js'; | ||
import Perfume, { IPerfumeConfig } from 'perfume.js'; | ||
export declare let perfume: any; | ||
@@ -12,13 +12,2 @@ export declare const PERFUME_CONFIG: InjectionToken<unknown>; | ||
config: IPerfumeConfig; | ||
firstPaintDuration: number; | ||
firstContentfulPaintDuration: number; | ||
firstInputDelayDuration: number; | ||
dataConsumption: number; | ||
largestContentfulPaintDuration: number; | ||
observeFirstPaint: Promise<number>; | ||
observeFirstContentfulPaint: Promise<number>; | ||
observeFirstInputDelay: Promise<number>; | ||
observeLargestContentfulPaint: Promise<number>; | ||
observeTimeToInteractive?: Promise<number>; | ||
timeToInteractiveDuration: number; | ||
constructor(); | ||
@@ -29,4 +18,2 @@ readonly navigationTiming: any; | ||
endPaint(metricName: string): Promise<void | number>; | ||
log(options: ILogOptions): void; | ||
sendTiming(options: ISendTimingOptions): void; | ||
} | ||
@@ -33,0 +20,0 @@ export declare class PerfumeModule { |
{ | ||
"name": "perfume.js/angular", | ||
"version": "3.2.1", | ||
"version": "4.0.0-rc9", | ||
"peerDependencies": { | ||
"@angular/common": "^6.0.0", | ||
"@angular/core": "^6.0.0", | ||
"perfume.js": "3.2.0" | ||
"perfume.js": "4.0.0-rc8" | ||
}, | ||
@@ -9,0 +9,0 @@ "main": "bundles/perfume.js-angular.umd.js", |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"perfume":{"__symbolic":"error","message":"Variable not initialized","line":14,"character":11,"module":"./lib/perfume.module"},"PERFUME_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":16,"character":34},"arguments":["Perfume.js config"]},"PerfumeRootModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":18,"character":1},"arguments":[{}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":15},"arguments":[{"__symbolic":"reference","name":"PERFUME_CONFIG"}]}]],"parameters":[{"__symbolic":"reference","module":"perfume.js","name":"IPerfumeConfig","line":20,"character":53}]}]}},"NgPerfume":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":25,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"start":[{"__symbolic":"method"}],"end":[{"__symbolic":"method"}],"endPaint":[{"__symbolic":"method"}],"log":[{"__symbolic":"method"}],"sendTiming":[{"__symbolic":"method"}]}},"PerfumeModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":81,"character":1},"arguments":[{"imports":[],"declarations":[],"exports":[]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbolic":"reference","name":"PerfumeRootModule"},"providers":[{"provide":{"__symbolic":"reference","name":"PERFUME_CONFIG"},"useValue":{"__symbolic":"reference","name":"config"}},{"__symbolic":"reference","name":"NgPerfume"}]}}}},"AfterViewInitable":{"__symbolic":"interface"},"PerfumeAfterViewInit":{"__symbolic":"function","parameters":["targetName"],"value":{"__symbolic":"error","message":"Lambda not supported","line":117,"character":9,"module":"./lib/perfume.module"}}},"origins":{"perfume":"./lib/perfume.module","PERFUME_CONFIG":"./lib/perfume.module","PerfumeRootModule":"./lib/perfume.module","NgPerfume":"./lib/perfume.module","PerfumeModule":"./lib/perfume.module","AfterViewInitable":"./lib/perfume.module","PerfumeAfterViewInit":"./lib/perfume.module"},"importAs":"perfume.js/angular"} | ||
{"__symbolic":"module","version":4,"metadata":{"perfume":{"__symbolic":"error","message":"Variable not initialized","line":18,"character":11,"module":"./lib/perfume.module"},"PERFUME_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"InjectionToken","line":20,"character":34},"arguments":["Perfume.js config"]},"PerfumeRootModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":22,"character":1},"arguments":[{}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":24,"character":15},"arguments":[{"__symbolic":"reference","name":"PERFUME_CONFIG"}]}]],"parameters":[{"__symbolic":"reference","module":"perfume.js","name":"IPerfumeConfig","line":24,"character":53}]}]}},"NgPerfume":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":29,"character":1}}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"start":[{"__symbolic":"method"}],"end":[{"__symbolic":"method"}],"endPaint":[{"__symbolic":"method"}]}},"PerfumeModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":55,"character":1},"arguments":[{"imports":[],"declarations":[],"exports":[]}]}],"members":{},"statics":{"forRoot":{"__symbolic":"function","parameters":["config"],"value":{"ngModule":{"__symbolic":"reference","name":"PerfumeRootModule"},"providers":[{"provide":{"__symbolic":"reference","name":"PERFUME_CONFIG"},"useValue":{"__symbolic":"reference","name":"config"}},{"__symbolic":"reference","name":"NgPerfume"}]}}}},"AfterViewInitable":{"__symbolic":"interface"},"PerfumeAfterViewInit":{"__symbolic":"function","parameters":["targetName"],"value":{"__symbolic":"error","message":"Lambda not supported","line":91,"character":9,"module":"./lib/perfume.module"}}},"origins":{"perfume":"./lib/perfume.module","PERFUME_CONFIG":"./lib/perfume.module","PerfumeRootModule":"./lib/perfume.module","NgPerfume":"./lib/perfume.module","PerfumeModule":"./lib/perfume.module","AfterViewInitable":"./lib/perfume.module","PerfumeAfterViewInit":"./lib/perfume.module"},"importAs":"perfume.js/angular"} |
@@ -12,10 +12,2 @@ var __assign = (this && this.__assign) || function () { | ||
}; | ||
/*! | ||
* Perfume.js v3.2.1 (http://zizzamia.github.io/perfume) | ||
* Copyright 2018 The Perfume Authors (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
* Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
* @license | ||
*/ | ||
import { detect } from './detect-browser'; | ||
import Performance from './performance'; | ||
var Perfume = /** @class */ (function () { | ||
@@ -35,3 +27,2 @@ function Perfume(options) { | ||
analyticsTracker: function (options) { }, | ||
browserTracker: false, | ||
// Logging | ||
@@ -45,15 +36,17 @@ logPrefix: 'Perfume.js:', | ||
}; | ||
this.firstPaintDuration = 0; | ||
this.firstContentfulPaintDuration = 0; | ||
this.firstInputDelayDuration = 0; | ||
this.c = window.console; | ||
this.d = document; | ||
this.dataConsumption = 0; | ||
this.isHidden = false; | ||
this.largestContentfulPaintDuration = 0; | ||
this.isHidden = false; | ||
this.logMetricWarn = 'Please provide a metric name'; | ||
this.logMetricWarn = 'Missing metric name'; | ||
this.logPrefixRecording = 'Recording already'; | ||
this.metrics = {}; | ||
this.observers = {}; | ||
this.navigationTimingCached = {}; | ||
this.perfObservers = {}; | ||
this.w = window; | ||
this.wp = window.performance; | ||
this.didVisibilityChange = function () { | ||
if (document.hidden) { | ||
_this.isHidden = document.hidden; | ||
if (_this.d.hidden) { | ||
_this.isHidden = _this.d.hidden; | ||
} | ||
@@ -63,13 +56,8 @@ }; | ||
this.config = Object.assign({}, this.config, options); | ||
this.perf = new Performance(); | ||
// Exit from Perfume when basic Web Performance APIs aren't supported | ||
if (!Performance.supported()) { | ||
if (!this.isPerformanceSupported()) { | ||
return; | ||
} | ||
// In case we want to track Browser version and OS | ||
if (this.config.browserTracker) { | ||
this.browser = detect(); | ||
} | ||
// Checks if use Performance or the EmulatedPerformance instance | ||
if (Performance.supportedPerformanceObserver()) { | ||
if (this.isPerformanceObserverSupported()) { | ||
this.initPerformanceObserver(); | ||
@@ -84,12 +72,2 @@ } | ||
} | ||
Object.defineProperty(Perfume.prototype, "navigationTiming", { | ||
get: function () { | ||
if (!this.config.navigationTiming) { | ||
return {}; | ||
} | ||
return this.perf.navigationTiming; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -99,7 +77,7 @@ * Start performance measurement | ||
Perfume.prototype.start = function (metricName) { | ||
if (!this.checkMetricName(metricName) || !Performance.supported()) { | ||
if (!this.checkMetricName(metricName) || !this.isPerformanceSupported()) { | ||
return; | ||
} | ||
if (this.metrics[metricName]) { | ||
this.logWarn('Recording already started.'); | ||
this.logWarn(this.logPrefixRecording + " started."); | ||
return; | ||
@@ -109,6 +87,6 @@ } | ||
end: 0, | ||
start: this.perf.now(), | ||
start: this.wp.now(), | ||
}; | ||
// Creates a timestamp in the browser's performance entry buffer | ||
this.perf.mark(metricName, 'start'); | ||
this.performanceMark(metricName, 'start'); | ||
// Reset hidden value | ||
@@ -122,3 +100,3 @@ this.isHidden = false; | ||
var _this = this; | ||
if (!this.checkMetricName(metricName) || !Performance.supported()) { | ||
if (!this.checkMetricName(metricName) || !this.isPerformanceSupported()) { | ||
return; | ||
@@ -128,10 +106,10 @@ } | ||
if (!metric) { | ||
this.logWarn('Recording already stopped.'); | ||
this.logWarn(this.logPrefixRecording + " stopped."); | ||
return; | ||
} | ||
// End Performance Mark | ||
metric.end = this.perf.now(); | ||
this.perf.mark(metricName, 'end'); | ||
metric.end = this.wp.now(); | ||
this.performanceMark(metricName, 'end'); | ||
// Get duration and change it to a two decimal value | ||
var duration = this.perf.measure(metricName, metric); | ||
var duration = this.performanceMeasure(metricName); | ||
var duration2Decimal = parseFloat(duration.toFixed(2)); | ||
@@ -158,102 +136,2 @@ delete this.metrics[metricName]; | ||
}; | ||
/** | ||
* Coloring Text in Browser Console | ||
*/ | ||
Perfume.prototype.log = function (options) { | ||
var _a = __assign({ suffix: 'ms' }, options), metricName = _a.metricName, data = _a.data, duration = _a.duration, suffix = _a.suffix; | ||
// Don't log when page is hidden or has disabled logging | ||
if (this.isHidden || !this.config.logging) { | ||
return; | ||
} | ||
if (!metricName) { | ||
this.logWarn(this.logMetricWarn); | ||
return; | ||
} | ||
var style = 'color: #ff6d00;font-size:11px;'; | ||
var text = "%c " + this.config.logPrefix + " " + metricName + " "; | ||
if (duration) { | ||
var durationMs = duration.toFixed(2); | ||
text += durationMs + " " + suffix; | ||
window.console.log(text, style); | ||
} | ||
else if (data) { | ||
window.console.log(text, style, data); | ||
} | ||
}; | ||
/** | ||
* 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); | ||
}; | ||
/** | ||
* Sends the User timing measure to analyticsTracker | ||
*/ | ||
Perfume.prototype.sendTiming = function (options) { | ||
var metricName = options.metricName, data = options.data, duration = options.duration; | ||
// Doesn't send timing when page is hidden | ||
if (this.isHidden) { | ||
return; | ||
} | ||
// Get Browser from userAgent | ||
var browser = this.config.browserTracker ? this.browser : undefined; | ||
var metricNameWithBrowser = this.addBrowserToMetricName(metricName); | ||
// Send metric to custom Analytics service | ||
this.config.analyticsTracker({ metricName: metricName, data: data, duration: duration, browser: browser }); | ||
}; | ||
Perfume.prototype.initPerformanceObserver = function () { | ||
var _this = this; | ||
// Init observe FCP and creates the Promise to observe metric | ||
if (this.config.firstPaint || this.config.firstContentfulPaint) { | ||
this.observeFirstPaint = new Promise(function (resolve) { | ||
_this.logDebug('observeFirstPaint'); | ||
_this.observers['firstPaint'] = resolve; | ||
}); | ||
this.observeFirstContentfulPaint = new Promise(function (resolve) { | ||
_this.logDebug('observeFirstContentfulPaint'); | ||
_this.observers['firstContentfulPaint'] = resolve; | ||
_this.initFirstPaint(); | ||
}); | ||
} | ||
// FID needs to be initialized as soon as Perfume is available, | ||
// which returns a Promise that can be observed. | ||
// DataConsumption resolves after FID is triggered | ||
this.observeFirstInputDelay = new Promise(function (resolve) { | ||
_this.observers['firstInputDelay'] = resolve; | ||
_this.initFirstInputDelay(); | ||
}); | ||
// Largest Contentful Paint | ||
this.observeLargestContentfulPaint = new Promise(function (resolve) { | ||
_this.observers['largestContentfulPaint'] = resolve; | ||
_this.initLargestContentfulPaint(); | ||
}); | ||
// Collects KB information related to resources on the page | ||
if (this.config.dataConsumption) { | ||
this.observeDataConsumption = new Promise(function (resolve) { | ||
_this.observers['dataConsumption'] = resolve; | ||
_this.initDataConsumption(); | ||
}); | ||
} | ||
}; | ||
Perfume.prototype.addBrowserToMetricName = function (metricName) { | ||
if (!this.config.browserTracker) { | ||
return metricName; | ||
} | ||
var metricNameWithBrowser = metricName; | ||
// Check if Browser Name exist | ||
if (this.browser.name) { | ||
var browserName = this.browser.name.replace(/\s/g, ''); | ||
metricNameWithBrowser += "." + browserName; | ||
// Check if Browser OS exist | ||
if (this.browser.os) { | ||
var browserOS = this.browser.os.replace(/\s/g, ''); | ||
metricNameWithBrowser += "." + browserOS; | ||
} | ||
} | ||
return metricNameWithBrowser; | ||
}; | ||
Perfume.prototype.checkMetricName = function (metricName) { | ||
@@ -266,65 +144,2 @@ if (metricName) { | ||
}; | ||
/** | ||
* Logging Performance Paint Timing | ||
*/ | ||
Perfume.prototype.performanceObserverCb = function (options) { | ||
var _this = this; | ||
this.logDebug('performanceObserverCb', options); | ||
options.entries.forEach(function (performanceEntry) { | ||
_this.pushTask(function () { | ||
if (_this.config[options.metricName] && | ||
(!options.entryName || | ||
(options.entryName && performanceEntry.name === options.entryName))) { | ||
_this.logMetric(performanceEntry[options.valueLog], options.metricLog, options.metricName); | ||
} | ||
}); | ||
if (_this.perfObservers.firstContentfulPaint && | ||
performanceEntry.name === 'first-contentful-paint') { | ||
_this.perfObservers.firstContentfulPaint.disconnect(); | ||
} | ||
}); | ||
if (this.perfObservers.firstInputDelay && | ||
options.metricName === 'firstInputDelay') { | ||
this.perfObservers.firstInputDelay.disconnect(); | ||
} | ||
}; | ||
Perfume.prototype.performanceObserverResourceCb = function (options) { | ||
var _this = this; | ||
this.logDebug('performanceObserverResourceCb', options); | ||
options.entries.forEach(function (performanceEntry) { | ||
if (performanceEntry.decodedBodySize) { | ||
var decodedBodySize = parseFloat((performanceEntry.decodedBodySize / 1000).toFixed(2)); | ||
_this.dataConsumption += decodedBodySize; | ||
} | ||
}); | ||
}; | ||
Perfume.prototype.digestFirstPaintEntries = function (entries) { | ||
this.performanceObserverCb({ | ||
entries: entries, | ||
entryName: 'first-paint', | ||
metricLog: 'First Paint', | ||
metricName: 'firstPaint', | ||
valueLog: 'startTime', | ||
}); | ||
this.performanceObserverCb({ | ||
entries: entries, | ||
entryName: 'first-contentful-paint', | ||
metricLog: 'First Contentful Paint', | ||
metricName: 'firstContentfulPaint', | ||
valueLog: 'startTime', | ||
}); | ||
}; | ||
/** | ||
* First Paint is essentially the paint after which | ||
* the biggest above-the-fold layout change has happened. | ||
*/ | ||
Perfume.prototype.initFirstPaint = function () { | ||
this.logDebug('initFirstPaint'); | ||
try { | ||
this.perfObservers.firstContentfulPaint = this.perf.performanceObserver('paint', this.digestFirstPaintEntries.bind(this)); | ||
} | ||
catch (e) { | ||
this.logWarn('initFirstPaint failed'); | ||
} | ||
}; | ||
Perfume.prototype.digestFirstInputDelayEntries = function (entries) { | ||
@@ -343,67 +158,164 @@ this.performanceObserverCb({ | ||
}; | ||
/** | ||
* Update `lcp` to the latest value, using `renderTime` if it's available, | ||
* otherwise using `loadTime`. (Note: `renderTime` may not be available if | ||
* the element is an image and it's loaded cross-origin without the | ||
* `Timing-Allow-Origin` header.) | ||
*/ | ||
Perfume.prototype.digestLargestContentfulPaint = function (entries) { | ||
this.logDebug('digestLargestContentfulPaint', entries); | ||
var lastPerformanceEntry = entries[entries.length - 1]; | ||
this.largestContentfulPaintDuration = | ||
lastPerformanceEntry.renderTime || lastPerformanceEntry.loadTime; | ||
Perfume.prototype.disconnectDataConsumption = function () { | ||
clearTimeout(this.dataConsumptionTimeout); | ||
if (!this.perfObservers.dataConsumption || !this.dataConsumption) { | ||
return; | ||
} | ||
this.logMetric(this.dataConsumption, 'Data Consumption', 'dataConsumption', 'Kb'); | ||
this.perfObservers.dataConsumption.disconnect(); | ||
}; | ||
Perfume.prototype.initFirstInputDelay = function () { | ||
Perfume.prototype.initDataConsumption = function () { | ||
var _this = this; | ||
try { | ||
this.perfObservers.firstInputDelay = this.perf.performanceObserver('first-input', this.digestFirstInputDelayEntries.bind(this)); | ||
this.perfObservers.dataConsumption = this.performanceObserver('resource', function (entries) { | ||
_this.performanceObserverResourceCb({ | ||
entries: entries, | ||
}); | ||
}); | ||
} | ||
catch (e) { | ||
this.logWarn('initFirstInputDelay failed'); | ||
this.logWarn('DataConsumption:failed'); | ||
} | ||
this.dataConsumptionTimeout = setTimeout(function () { | ||
_this.disconnectDataConsumption(); | ||
}, 15000); | ||
}; | ||
Perfume.prototype.initLargestContentfulPaint = function () { | ||
Perfume.prototype.initFirstInputDelay = function () { | ||
try { | ||
this.perfObservers.largestContentfulPaint = this.perf.performanceObserver('largest-contentful-paint', this.digestLargestContentfulPaint.bind(this)); | ||
this.perfObservers.firstInputDelay = this.performanceObserver('first-input', this.digestFirstInputDelayEntries.bind(this)); | ||
} | ||
catch (e) { | ||
this.logWarn('initLargestContentfulPaint failed'); | ||
this.logWarn('FID:failed'); | ||
} | ||
}; | ||
Perfume.prototype.digestDataConsumptionEntries = function (entries) { | ||
this.performanceObserverResourceCb({ | ||
entries: entries, | ||
}); | ||
}; | ||
Perfume.prototype.disconnectDataConsumption = function () { | ||
clearTimeout(this.dataConsumptionTimeout); | ||
if (!this.perfObservers.dataConsumption || !this.dataConsumption) { | ||
return; | ||
/** | ||
* First Paint is essentially the paint after which | ||
* the biggest above-the-fold layout change has happened. | ||
*/ | ||
Perfume.prototype.initFirstPaint = function () { | ||
var _this = this; | ||
try { | ||
this.perfObservers.firstContentfulPaint = this.performanceObserver('paint', function (entries) { | ||
_this.performanceObserverCb({ | ||
entries: entries, | ||
entryName: 'first-paint', | ||
metricLog: 'First Paint', | ||
metricName: 'firstPaint', | ||
valueLog: 'startTime', | ||
}); | ||
_this.performanceObserverCb({ | ||
entries: entries, | ||
entryName: 'first-contentful-paint', | ||
metricLog: 'First Contentful Paint', | ||
metricName: 'firstContentfulPaint', | ||
valueLog: 'startTime', | ||
}); | ||
}); | ||
} | ||
this.logMetric(this.dataConsumption, 'Data Consumption', 'dataConsumption', 'Kb'); | ||
this.perfObservers.dataConsumption.disconnect(); | ||
catch (e) { | ||
this.logWarn('FP:failed'); | ||
} | ||
}; | ||
Perfume.prototype.initDataConsumption = function () { | ||
Perfume.prototype.initLargestContentfulPaint = function () { | ||
var _this = this; | ||
try { | ||
this.perfObservers.dataConsumption = this.perf.performanceObserver('resource', this.digestDataConsumptionEntries.bind(this)); | ||
this.perfObservers.largestContentfulPaint = this.performanceObserver('largest-contentful-paint', function (entries) { | ||
_this.logDebug('PerformanceEntry:LCP', entries); | ||
var lastPerformanceEntry = entries[entries.length - 1]; | ||
_this.largestContentfulPaintDuration = | ||
lastPerformanceEntry.renderTime || lastPerformanceEntry.loadTime; | ||
}); | ||
} | ||
catch (e) { | ||
this.logWarn('initDataConsumption failed'); | ||
this.logWarn('LCP:failed'); | ||
} | ||
this.dataConsumptionTimeout = setTimeout(function () { | ||
_this.disconnectDataConsumption(); | ||
}, 15000); | ||
}; | ||
Perfume.prototype.initPerformanceObserver = function () { | ||
if (this.config.firstPaint || this.config.firstContentfulPaint) { | ||
this.initFirstPaint(); | ||
} | ||
// FID needs to be initialized as soon as Perfume is available | ||
// DataConsumption resolves after FID is triggered | ||
this.initFirstInputDelay(); | ||
this.initLargestContentfulPaint(); | ||
// Collects KB information related to resources on the page | ||
if (this.config.dataConsumption) { | ||
this.initDataConsumption(); | ||
} | ||
}; | ||
/** | ||
* From visibilitychange listener it saves only when | ||
* the page gets hidden, because it's important to not | ||
* use the wrong "hidden" value when send timing or logging. | ||
* 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 | ||
*/ | ||
Perfume.prototype.onVisibilityChange = function () { | ||
if (typeof document.hidden !== 'undefined') { | ||
// Opera 12.10 and Firefox 18 and later support | ||
document.addEventListener('visibilitychange', this.didVisibilityChange); | ||
Perfume.prototype.isPerformanceSupported = function () { | ||
return (this.wp && !!this.wp.getEntriesByType && !!this.wp.now && !!this.wp.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 | ||
*/ | ||
Perfume.prototype.isPerformanceObserverSupported = function () { | ||
return this.w.chrome && 'PerformanceObserver' in this.w; | ||
}; | ||
/** | ||
* Get the duration of the timing metric or -1 if there a measurement has | ||
* not been made by the User Timing API | ||
*/ | ||
Perfume.prototype.getDurationByMetric = function (metricName) { | ||
var entries = this.wp.getEntriesByName(metricName); | ||
var entry = entries[entries.length - 1]; | ||
if (entry && entry.entryType === 'measure') { | ||
return entry.duration; | ||
} | ||
return -1; | ||
}; | ||
/** | ||
* Navigation Timing API provides performance metrics for HTML documents. | ||
* w3c.github.io/navigation-timing/ | ||
* developers.google.com/web/fundamentals/performance/navigation-and-resource-timing | ||
*/ | ||
Perfume.prototype.getNavigationTiming = function () { | ||
if (!this.config.navigationTiming) { | ||
return {}; | ||
} | ||
if (!this.isPerformanceSupported() || | ||
Object.keys(this.navigationTimingCached).length) { | ||
return this.navigationTimingCached; | ||
} | ||
// There is an open issue to type correctly getEntriesByType | ||
// github.com/microsoft/TypeScript/issues/33866 | ||
var n = performance.getEntriesByType('navigation')[0]; | ||
// In Safari version 11.2 Navigation Timing isn't supported yet | ||
if (!n) { | ||
return this.navigationTimingCached; | ||
} | ||
var responseStart = n.responseStart; | ||
var responseEnd = n.responseEnd; | ||
// We cache the navigation time for future times | ||
this.navigationTimingCached = { | ||
// fetchStart marks when the browser starts to fetch a resource | ||
// responseEnd is when the last byte of the response arrives | ||
fetchTime: parseFloat((responseEnd - n.fetchStart).toFixed(2)), | ||
// Service worker time plus response time | ||
workerTime: parseFloat((n.workerStart > 0 ? responseEnd - n.workerStart : 0).toFixed(2)), | ||
// Request plus response time (network only) | ||
totalTime: parseFloat((responseEnd - n.requestStart).toFixed(2)), | ||
// Response time only (download) | ||
downloadTime: parseFloat((responseEnd - responseStart).toFixed(2)), | ||
// Time to First Byte (TTFB) | ||
timeToFirstByte: parseFloat((responseStart - n.requestStart).toFixed(2)), | ||
// HTTP header size | ||
headerSize: parseFloat((n.transferSize - n.encodedBodySize).toFixed(2)), | ||
// Measuring DNS lookup time | ||
dnsLookupTime: parseFloat((n.domainLookupEnd - n.domainLookupStart).toFixed(2)), | ||
}; | ||
return this.navigationTimingCached; | ||
}; | ||
/** | ||
* Dispatches the metric duration into internal logs | ||
@@ -424,13 +336,2 @@ * and the external time tracking service. | ||
} | ||
// Save metrics in Duration property | ||
if (metricName === 'firstPaint') { | ||
this.firstPaintDuration = duration2Decimal; | ||
} | ||
if (metricName === 'firstContentfulPaint') { | ||
this.firstContentfulPaintDuration = duration2Decimal; | ||
} | ||
if (metricName === 'firstInputDelay') { | ||
this.firstInputDelayDuration = duration2Decimal; | ||
} | ||
this.observers[metricName](duration2Decimal); | ||
// Logs the metric in the internal console.log | ||
@@ -441,8 +342,42 @@ this.log({ metricName: logText, duration: duration2Decimal, suffix: suffix }); | ||
}; | ||
/** | ||
* Coloring Text in Browser Console | ||
*/ | ||
Perfume.prototype.log = function (options) { | ||
var _a = __assign({ suffix: 'ms' }, options), metricName = _a.metricName, data = _a.data, duration = _a.duration, suffix = _a.suffix; | ||
// Don't log when page is hidden or has disabled logging | ||
if (this.isHidden || !this.config.logging) { | ||
return; | ||
} | ||
if (!metricName) { | ||
this.logWarn(this.logMetricWarn); | ||
return; | ||
} | ||
var style = 'color: #ff6d00;font-size:11px;'; | ||
var text = "%c " + this.config.logPrefix + " " + metricName + " "; | ||
if (duration) { | ||
var durationMs = duration.toFixed(2); | ||
text += durationMs + " " + suffix; | ||
this.c.log(text, style); | ||
} | ||
else if (data) { | ||
this.c.log(text, style, data); | ||
} | ||
}; | ||
/** | ||
* Coloring Debugging Text in Browser Console | ||
*/ | ||
Perfume.prototype.logDebug = function (methodName, debugValue) { | ||
if (debugValue === void 0) { debugValue = ''; } | ||
if (!this.config.debugging) { | ||
return; | ||
} | ||
this.c.log(this.config.logPrefix + " debugging " + methodName + ":", debugValue); | ||
}; | ||
Perfume.prototype.logNavigationTiming = function () { | ||
var metricName = 'NavigationTiming'; | ||
var metricName = 'navigationTiming'; | ||
// Logs the metric in the internal console.log | ||
this.log({ metricName: metricName, data: this.navigationTiming, suffix: '' }); | ||
this.log({ metricName: metricName, data: this.getNavigationTiming(), suffix: '' }); | ||
// Sends the metric to an external tracking service | ||
this.sendTiming({ metricName: metricName, data: this.navigationTiming }); | ||
this.sendTiming({ metricName: metricName, data: this.getNavigationTiming() }); | ||
}; | ||
@@ -457,10 +392,78 @@ /** | ||
} | ||
window.console.warn(this.config.logPrefix, message); | ||
this.c.warn(this.config.logPrefix, message); | ||
}; | ||
/** | ||
* From visibilitychange listener it saves only when | ||
* the page gets hidden, because it's important to not | ||
* use the wrong "hidden" value when send timing or logging. | ||
*/ | ||
Perfume.prototype.onVisibilityChange = function () { | ||
if (typeof this.d.hidden !== 'undefined') { | ||
// Opera 12.10 and Firefox 18 and later support | ||
this.d.addEventListener('visibilitychange', this.didVisibilityChange); | ||
} | ||
}; | ||
Perfume.prototype.performanceMark = function (metricName, type) { | ||
var mark = "mark_" + metricName + "_" + type; | ||
this.wp.mark(mark); | ||
}; | ||
Perfume.prototype.performanceMeasure = function (metricName) { | ||
var startMark = "mark_" + metricName + "_start"; | ||
var endMark = "mark_" + metricName + "_end"; | ||
this.wp.measure(metricName, startMark, endMark); | ||
return this.getDurationByMetric(metricName); | ||
}; | ||
/** | ||
* PerformanceObserver subscribes to performance events as they happen | ||
* and respond to them asynchronously. | ||
*/ | ||
Perfume.prototype.performanceObserver = function (eventType, cb) { | ||
this.perfObserver = new PerformanceObserver(function (entryList) { | ||
var entries = entryList.getEntries(); | ||
cb(entries); | ||
}); | ||
// Retrieve buffered events and subscribe to newer events for Paint Timing | ||
this.perfObserver.observe({ type: eventType, buffered: true }); | ||
return this.perfObserver; | ||
}; | ||
/** | ||
* Logging Performance Paint Timing | ||
*/ | ||
Perfume.prototype.performanceObserverCb = function (options) { | ||
var _this = this; | ||
this.logDebug('PerformanceEntry', options); | ||
options.entries.forEach(function (performanceEntry) { | ||
_this.pushTask(function () { | ||
if (_this.config[options.metricName] && | ||
(!options.entryName || | ||
(options.entryName && performanceEntry.name === options.entryName))) { | ||
_this.logMetric(performanceEntry[options.valueLog], options.metricLog, options.metricName); | ||
} | ||
}); | ||
if (_this.perfObservers.firstContentfulPaint && | ||
performanceEntry.name === 'first-contentful-paint') { | ||
_this.perfObservers.firstContentfulPaint.disconnect(); | ||
} | ||
}); | ||
if (this.perfObservers.firstInputDelay && | ||
options.metricName === 'firstInputDelay') { | ||
this.perfObservers.firstInputDelay.disconnect(); | ||
} | ||
}; | ||
Perfume.prototype.performanceObserverResourceCb = function (options) { | ||
var _this = this; | ||
this.logDebug('PerformanceEntry:resource', options); | ||
options.entries.forEach(function (performanceEntry) { | ||
if (performanceEntry.decodedBodySize) { | ||
var decodedBodySize = parseFloat((performanceEntry.decodedBodySize / 1000).toFixed(2)); | ||
_this.dataConsumption += decodedBodySize; | ||
} | ||
}); | ||
}; | ||
/** | ||
* PushTask to requestIdleCallback | ||
*/ | ||
Perfume.prototype.pushTask = function (cb) { | ||
if ('requestIdleCallback' in window) { | ||
window.requestIdleCallback(cb, { timeout: 3000 }); | ||
if ('requestIdleCallback' in this.w) { | ||
this.w.requestIdleCallback(cb, { timeout: 3000 }); | ||
} | ||
@@ -471,2 +474,14 @@ else { | ||
}; | ||
/** | ||
* Sends the User timing measure to analyticsTracker | ||
*/ | ||
Perfume.prototype.sendTiming = function (options) { | ||
var metricName = options.metricName, data = options.data, duration = options.duration; | ||
// Doesn't send timing when page is hidden | ||
if (this.isHidden) { | ||
return; | ||
} | ||
// Send metric to custom Analytics service | ||
this.config.analyticsTracker({ metricName: metricName, data: data, duration: duration }); | ||
}; | ||
return Perfume; | ||
@@ -473,0 +488,0 @@ }()); |
@@ -14,10 +14,2 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/*! | ||
* Perfume.js v3.2.1 (http://zizzamia.github.io/perfume) | ||
* Copyright 2018 The Perfume Authors (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
* Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
* @license | ||
*/ | ||
var detect_browser_1 = require("./detect-browser"); | ||
var performance_1 = require("./performance"); | ||
var Perfume = /** @class */ (function () { | ||
@@ -37,3 +29,2 @@ function Perfume(options) { | ||
analyticsTracker: function (options) { }, | ||
browserTracker: false, | ||
// Logging | ||
@@ -47,15 +38,17 @@ logPrefix: 'Perfume.js:', | ||
}; | ||
this.firstPaintDuration = 0; | ||
this.firstContentfulPaintDuration = 0; | ||
this.firstInputDelayDuration = 0; | ||
this.c = window.console; | ||
this.d = document; | ||
this.dataConsumption = 0; | ||
this.isHidden = false; | ||
this.largestContentfulPaintDuration = 0; | ||
this.isHidden = false; | ||
this.logMetricWarn = 'Please provide a metric name'; | ||
this.logMetricWarn = 'Missing metric name'; | ||
this.logPrefixRecording = 'Recording already'; | ||
this.metrics = {}; | ||
this.observers = {}; | ||
this.navigationTimingCached = {}; | ||
this.perfObservers = {}; | ||
this.w = window; | ||
this.wp = window.performance; | ||
this.didVisibilityChange = function () { | ||
if (document.hidden) { | ||
_this.isHidden = document.hidden; | ||
if (_this.d.hidden) { | ||
_this.isHidden = _this.d.hidden; | ||
} | ||
@@ -65,13 +58,8 @@ }; | ||
this.config = Object.assign({}, this.config, options); | ||
this.perf = new performance_1.default(); | ||
// Exit from Perfume when basic Web Performance APIs aren't supported | ||
if (!performance_1.default.supported()) { | ||
if (!this.isPerformanceSupported()) { | ||
return; | ||
} | ||
// In case we want to track Browser version and OS | ||
if (this.config.browserTracker) { | ||
this.browser = detect_browser_1.detect(); | ||
} | ||
// Checks if use Performance or the EmulatedPerformance instance | ||
if (performance_1.default.supportedPerformanceObserver()) { | ||
if (this.isPerformanceObserverSupported()) { | ||
this.initPerformanceObserver(); | ||
@@ -86,12 +74,2 @@ } | ||
} | ||
Object.defineProperty(Perfume.prototype, "navigationTiming", { | ||
get: function () { | ||
if (!this.config.navigationTiming) { | ||
return {}; | ||
} | ||
return this.perf.navigationTiming; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
/** | ||
@@ -101,7 +79,7 @@ * Start performance measurement | ||
Perfume.prototype.start = function (metricName) { | ||
if (!this.checkMetricName(metricName) || !performance_1.default.supported()) { | ||
if (!this.checkMetricName(metricName) || !this.isPerformanceSupported()) { | ||
return; | ||
} | ||
if (this.metrics[metricName]) { | ||
this.logWarn('Recording already started.'); | ||
this.logWarn(this.logPrefixRecording + " started."); | ||
return; | ||
@@ -111,6 +89,6 @@ } | ||
end: 0, | ||
start: this.perf.now(), | ||
start: this.wp.now(), | ||
}; | ||
// Creates a timestamp in the browser's performance entry buffer | ||
this.perf.mark(metricName, 'start'); | ||
this.performanceMark(metricName, 'start'); | ||
// Reset hidden value | ||
@@ -124,3 +102,3 @@ this.isHidden = false; | ||
var _this = this; | ||
if (!this.checkMetricName(metricName) || !performance_1.default.supported()) { | ||
if (!this.checkMetricName(metricName) || !this.isPerformanceSupported()) { | ||
return; | ||
@@ -130,10 +108,10 @@ } | ||
if (!metric) { | ||
this.logWarn('Recording already stopped.'); | ||
this.logWarn(this.logPrefixRecording + " stopped."); | ||
return; | ||
} | ||
// End Performance Mark | ||
metric.end = this.perf.now(); | ||
this.perf.mark(metricName, 'end'); | ||
metric.end = this.wp.now(); | ||
this.performanceMark(metricName, 'end'); | ||
// Get duration and change it to a two decimal value | ||
var duration = this.perf.measure(metricName, metric); | ||
var duration = this.performanceMeasure(metricName); | ||
var duration2Decimal = parseFloat(duration.toFixed(2)); | ||
@@ -160,102 +138,2 @@ delete this.metrics[metricName]; | ||
}; | ||
/** | ||
* Coloring Text in Browser Console | ||
*/ | ||
Perfume.prototype.log = function (options) { | ||
var _a = __assign({ suffix: 'ms' }, options), metricName = _a.metricName, data = _a.data, duration = _a.duration, suffix = _a.suffix; | ||
// Don't log when page is hidden or has disabled logging | ||
if (this.isHidden || !this.config.logging) { | ||
return; | ||
} | ||
if (!metricName) { | ||
this.logWarn(this.logMetricWarn); | ||
return; | ||
} | ||
var style = 'color: #ff6d00;font-size:11px;'; | ||
var text = "%c " + this.config.logPrefix + " " + metricName + " "; | ||
if (duration) { | ||
var durationMs = duration.toFixed(2); | ||
text += durationMs + " " + suffix; | ||
window.console.log(text, style); | ||
} | ||
else if (data) { | ||
window.console.log(text, style, data); | ||
} | ||
}; | ||
/** | ||
* 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); | ||
}; | ||
/** | ||
* Sends the User timing measure to analyticsTracker | ||
*/ | ||
Perfume.prototype.sendTiming = function (options) { | ||
var metricName = options.metricName, data = options.data, duration = options.duration; | ||
// Doesn't send timing when page is hidden | ||
if (this.isHidden) { | ||
return; | ||
} | ||
// Get Browser from userAgent | ||
var browser = this.config.browserTracker ? this.browser : undefined; | ||
var metricNameWithBrowser = this.addBrowserToMetricName(metricName); | ||
// Send metric to custom Analytics service | ||
this.config.analyticsTracker({ metricName: metricName, data: data, duration: duration, browser: browser }); | ||
}; | ||
Perfume.prototype.initPerformanceObserver = function () { | ||
var _this = this; | ||
// Init observe FCP and creates the Promise to observe metric | ||
if (this.config.firstPaint || this.config.firstContentfulPaint) { | ||
this.observeFirstPaint = new Promise(function (resolve) { | ||
_this.logDebug('observeFirstPaint'); | ||
_this.observers['firstPaint'] = resolve; | ||
}); | ||
this.observeFirstContentfulPaint = new Promise(function (resolve) { | ||
_this.logDebug('observeFirstContentfulPaint'); | ||
_this.observers['firstContentfulPaint'] = resolve; | ||
_this.initFirstPaint(); | ||
}); | ||
} | ||
// FID needs to be initialized as soon as Perfume is available, | ||
// which returns a Promise that can be observed. | ||
// DataConsumption resolves after FID is triggered | ||
this.observeFirstInputDelay = new Promise(function (resolve) { | ||
_this.observers['firstInputDelay'] = resolve; | ||
_this.initFirstInputDelay(); | ||
}); | ||
// Largest Contentful Paint | ||
this.observeLargestContentfulPaint = new Promise(function (resolve) { | ||
_this.observers['largestContentfulPaint'] = resolve; | ||
_this.initLargestContentfulPaint(); | ||
}); | ||
// Collects KB information related to resources on the page | ||
if (this.config.dataConsumption) { | ||
this.observeDataConsumption = new Promise(function (resolve) { | ||
_this.observers['dataConsumption'] = resolve; | ||
_this.initDataConsumption(); | ||
}); | ||
} | ||
}; | ||
Perfume.prototype.addBrowserToMetricName = function (metricName) { | ||
if (!this.config.browserTracker) { | ||
return metricName; | ||
} | ||
var metricNameWithBrowser = metricName; | ||
// Check if Browser Name exist | ||
if (this.browser.name) { | ||
var browserName = this.browser.name.replace(/\s/g, ''); | ||
metricNameWithBrowser += "." + browserName; | ||
// Check if Browser OS exist | ||
if (this.browser.os) { | ||
var browserOS = this.browser.os.replace(/\s/g, ''); | ||
metricNameWithBrowser += "." + browserOS; | ||
} | ||
} | ||
return metricNameWithBrowser; | ||
}; | ||
Perfume.prototype.checkMetricName = function (metricName) { | ||
@@ -268,65 +146,2 @@ if (metricName) { | ||
}; | ||
/** | ||
* Logging Performance Paint Timing | ||
*/ | ||
Perfume.prototype.performanceObserverCb = function (options) { | ||
var _this = this; | ||
this.logDebug('performanceObserverCb', options); | ||
options.entries.forEach(function (performanceEntry) { | ||
_this.pushTask(function () { | ||
if (_this.config[options.metricName] && | ||
(!options.entryName || | ||
(options.entryName && performanceEntry.name === options.entryName))) { | ||
_this.logMetric(performanceEntry[options.valueLog], options.metricLog, options.metricName); | ||
} | ||
}); | ||
if (_this.perfObservers.firstContentfulPaint && | ||
performanceEntry.name === 'first-contentful-paint') { | ||
_this.perfObservers.firstContentfulPaint.disconnect(); | ||
} | ||
}); | ||
if (this.perfObservers.firstInputDelay && | ||
options.metricName === 'firstInputDelay') { | ||
this.perfObservers.firstInputDelay.disconnect(); | ||
} | ||
}; | ||
Perfume.prototype.performanceObserverResourceCb = function (options) { | ||
var _this = this; | ||
this.logDebug('performanceObserverResourceCb', options); | ||
options.entries.forEach(function (performanceEntry) { | ||
if (performanceEntry.decodedBodySize) { | ||
var decodedBodySize = parseFloat((performanceEntry.decodedBodySize / 1000).toFixed(2)); | ||
_this.dataConsumption += decodedBodySize; | ||
} | ||
}); | ||
}; | ||
Perfume.prototype.digestFirstPaintEntries = function (entries) { | ||
this.performanceObserverCb({ | ||
entries: entries, | ||
entryName: 'first-paint', | ||
metricLog: 'First Paint', | ||
metricName: 'firstPaint', | ||
valueLog: 'startTime', | ||
}); | ||
this.performanceObserverCb({ | ||
entries: entries, | ||
entryName: 'first-contentful-paint', | ||
metricLog: 'First Contentful Paint', | ||
metricName: 'firstContentfulPaint', | ||
valueLog: 'startTime', | ||
}); | ||
}; | ||
/** | ||
* First Paint is essentially the paint after which | ||
* the biggest above-the-fold layout change has happened. | ||
*/ | ||
Perfume.prototype.initFirstPaint = function () { | ||
this.logDebug('initFirstPaint'); | ||
try { | ||
this.perfObservers.firstContentfulPaint = this.perf.performanceObserver('paint', this.digestFirstPaintEntries.bind(this)); | ||
} | ||
catch (e) { | ||
this.logWarn('initFirstPaint failed'); | ||
} | ||
}; | ||
Perfume.prototype.digestFirstInputDelayEntries = function (entries) { | ||
@@ -345,67 +160,164 @@ this.performanceObserverCb({ | ||
}; | ||
/** | ||
* Update `lcp` to the latest value, using `renderTime` if it's available, | ||
* otherwise using `loadTime`. (Note: `renderTime` may not be available if | ||
* the element is an image and it's loaded cross-origin without the | ||
* `Timing-Allow-Origin` header.) | ||
*/ | ||
Perfume.prototype.digestLargestContentfulPaint = function (entries) { | ||
this.logDebug('digestLargestContentfulPaint', entries); | ||
var lastPerformanceEntry = entries[entries.length - 1]; | ||
this.largestContentfulPaintDuration = | ||
lastPerformanceEntry.renderTime || lastPerformanceEntry.loadTime; | ||
Perfume.prototype.disconnectDataConsumption = function () { | ||
clearTimeout(this.dataConsumptionTimeout); | ||
if (!this.perfObservers.dataConsumption || !this.dataConsumption) { | ||
return; | ||
} | ||
this.logMetric(this.dataConsumption, 'Data Consumption', 'dataConsumption', 'Kb'); | ||
this.perfObservers.dataConsumption.disconnect(); | ||
}; | ||
Perfume.prototype.initFirstInputDelay = function () { | ||
Perfume.prototype.initDataConsumption = function () { | ||
var _this = this; | ||
try { | ||
this.perfObservers.firstInputDelay = this.perf.performanceObserver('first-input', this.digestFirstInputDelayEntries.bind(this)); | ||
this.perfObservers.dataConsumption = this.performanceObserver('resource', function (entries) { | ||
_this.performanceObserverResourceCb({ | ||
entries: entries, | ||
}); | ||
}); | ||
} | ||
catch (e) { | ||
this.logWarn('initFirstInputDelay failed'); | ||
this.logWarn('DataConsumption:failed'); | ||
} | ||
this.dataConsumptionTimeout = setTimeout(function () { | ||
_this.disconnectDataConsumption(); | ||
}, 15000); | ||
}; | ||
Perfume.prototype.initLargestContentfulPaint = function () { | ||
Perfume.prototype.initFirstInputDelay = function () { | ||
try { | ||
this.perfObservers.largestContentfulPaint = this.perf.performanceObserver('largest-contentful-paint', this.digestLargestContentfulPaint.bind(this)); | ||
this.perfObservers.firstInputDelay = this.performanceObserver('first-input', this.digestFirstInputDelayEntries.bind(this)); | ||
} | ||
catch (e) { | ||
this.logWarn('initLargestContentfulPaint failed'); | ||
this.logWarn('FID:failed'); | ||
} | ||
}; | ||
Perfume.prototype.digestDataConsumptionEntries = function (entries) { | ||
this.performanceObserverResourceCb({ | ||
entries: entries, | ||
}); | ||
}; | ||
Perfume.prototype.disconnectDataConsumption = function () { | ||
clearTimeout(this.dataConsumptionTimeout); | ||
if (!this.perfObservers.dataConsumption || !this.dataConsumption) { | ||
return; | ||
/** | ||
* First Paint is essentially the paint after which | ||
* the biggest above-the-fold layout change has happened. | ||
*/ | ||
Perfume.prototype.initFirstPaint = function () { | ||
var _this = this; | ||
try { | ||
this.perfObservers.firstContentfulPaint = this.performanceObserver('paint', function (entries) { | ||
_this.performanceObserverCb({ | ||
entries: entries, | ||
entryName: 'first-paint', | ||
metricLog: 'First Paint', | ||
metricName: 'firstPaint', | ||
valueLog: 'startTime', | ||
}); | ||
_this.performanceObserverCb({ | ||
entries: entries, | ||
entryName: 'first-contentful-paint', | ||
metricLog: 'First Contentful Paint', | ||
metricName: 'firstContentfulPaint', | ||
valueLog: 'startTime', | ||
}); | ||
}); | ||
} | ||
this.logMetric(this.dataConsumption, 'Data Consumption', 'dataConsumption', 'Kb'); | ||
this.perfObservers.dataConsumption.disconnect(); | ||
catch (e) { | ||
this.logWarn('FP:failed'); | ||
} | ||
}; | ||
Perfume.prototype.initDataConsumption = function () { | ||
Perfume.prototype.initLargestContentfulPaint = function () { | ||
var _this = this; | ||
try { | ||
this.perfObservers.dataConsumption = this.perf.performanceObserver('resource', this.digestDataConsumptionEntries.bind(this)); | ||
this.perfObservers.largestContentfulPaint = this.performanceObserver('largest-contentful-paint', function (entries) { | ||
_this.logDebug('PerformanceEntry:LCP', entries); | ||
var lastPerformanceEntry = entries[entries.length - 1]; | ||
_this.largestContentfulPaintDuration = | ||
lastPerformanceEntry.renderTime || lastPerformanceEntry.loadTime; | ||
}); | ||
} | ||
catch (e) { | ||
this.logWarn('initDataConsumption failed'); | ||
this.logWarn('LCP:failed'); | ||
} | ||
this.dataConsumptionTimeout = setTimeout(function () { | ||
_this.disconnectDataConsumption(); | ||
}, 15000); | ||
}; | ||
Perfume.prototype.initPerformanceObserver = function () { | ||
if (this.config.firstPaint || this.config.firstContentfulPaint) { | ||
this.initFirstPaint(); | ||
} | ||
// FID needs to be initialized as soon as Perfume is available | ||
// DataConsumption resolves after FID is triggered | ||
this.initFirstInputDelay(); | ||
this.initLargestContentfulPaint(); | ||
// Collects KB information related to resources on the page | ||
if (this.config.dataConsumption) { | ||
this.initDataConsumption(); | ||
} | ||
}; | ||
/** | ||
* From visibilitychange listener it saves only when | ||
* the page gets hidden, because it's important to not | ||
* use the wrong "hidden" value when send timing or logging. | ||
* 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 | ||
*/ | ||
Perfume.prototype.onVisibilityChange = function () { | ||
if (typeof document.hidden !== 'undefined') { | ||
// Opera 12.10 and Firefox 18 and later support | ||
document.addEventListener('visibilitychange', this.didVisibilityChange); | ||
Perfume.prototype.isPerformanceSupported = function () { | ||
return (this.wp && !!this.wp.getEntriesByType && !!this.wp.now && !!this.wp.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 | ||
*/ | ||
Perfume.prototype.isPerformanceObserverSupported = function () { | ||
return this.w.chrome && 'PerformanceObserver' in this.w; | ||
}; | ||
/** | ||
* Get the duration of the timing metric or -1 if there a measurement has | ||
* not been made by the User Timing API | ||
*/ | ||
Perfume.prototype.getDurationByMetric = function (metricName) { | ||
var entries = this.wp.getEntriesByName(metricName); | ||
var entry = entries[entries.length - 1]; | ||
if (entry && entry.entryType === 'measure') { | ||
return entry.duration; | ||
} | ||
return -1; | ||
}; | ||
/** | ||
* Navigation Timing API provides performance metrics for HTML documents. | ||
* w3c.github.io/navigation-timing/ | ||
* developers.google.com/web/fundamentals/performance/navigation-and-resource-timing | ||
*/ | ||
Perfume.prototype.getNavigationTiming = function () { | ||
if (!this.config.navigationTiming) { | ||
return {}; | ||
} | ||
if (!this.isPerformanceSupported() || | ||
Object.keys(this.navigationTimingCached).length) { | ||
return this.navigationTimingCached; | ||
} | ||
// There is an open issue to type correctly getEntriesByType | ||
// github.com/microsoft/TypeScript/issues/33866 | ||
var n = performance.getEntriesByType('navigation')[0]; | ||
// In Safari version 11.2 Navigation Timing isn't supported yet | ||
if (!n) { | ||
return this.navigationTimingCached; | ||
} | ||
var responseStart = n.responseStart; | ||
var responseEnd = n.responseEnd; | ||
// We cache the navigation time for future times | ||
this.navigationTimingCached = { | ||
// fetchStart marks when the browser starts to fetch a resource | ||
// responseEnd is when the last byte of the response arrives | ||
fetchTime: parseFloat((responseEnd - n.fetchStart).toFixed(2)), | ||
// Service worker time plus response time | ||
workerTime: parseFloat((n.workerStart > 0 ? responseEnd - n.workerStart : 0).toFixed(2)), | ||
// Request plus response time (network only) | ||
totalTime: parseFloat((responseEnd - n.requestStart).toFixed(2)), | ||
// Response time only (download) | ||
downloadTime: parseFloat((responseEnd - responseStart).toFixed(2)), | ||
// Time to First Byte (TTFB) | ||
timeToFirstByte: parseFloat((responseStart - n.requestStart).toFixed(2)), | ||
// HTTP header size | ||
headerSize: parseFloat((n.transferSize - n.encodedBodySize).toFixed(2)), | ||
// Measuring DNS lookup time | ||
dnsLookupTime: parseFloat((n.domainLookupEnd - n.domainLookupStart).toFixed(2)), | ||
}; | ||
return this.navigationTimingCached; | ||
}; | ||
/** | ||
* Dispatches the metric duration into internal logs | ||
@@ -426,13 +338,2 @@ * and the external time tracking service. | ||
} | ||
// Save metrics in Duration property | ||
if (metricName === 'firstPaint') { | ||
this.firstPaintDuration = duration2Decimal; | ||
} | ||
if (metricName === 'firstContentfulPaint') { | ||
this.firstContentfulPaintDuration = duration2Decimal; | ||
} | ||
if (metricName === 'firstInputDelay') { | ||
this.firstInputDelayDuration = duration2Decimal; | ||
} | ||
this.observers[metricName](duration2Decimal); | ||
// Logs the metric in the internal console.log | ||
@@ -443,8 +344,42 @@ this.log({ metricName: logText, duration: duration2Decimal, suffix: suffix }); | ||
}; | ||
/** | ||
* Coloring Text in Browser Console | ||
*/ | ||
Perfume.prototype.log = function (options) { | ||
var _a = __assign({ suffix: 'ms' }, options), metricName = _a.metricName, data = _a.data, duration = _a.duration, suffix = _a.suffix; | ||
// Don't log when page is hidden or has disabled logging | ||
if (this.isHidden || !this.config.logging) { | ||
return; | ||
} | ||
if (!metricName) { | ||
this.logWarn(this.logMetricWarn); | ||
return; | ||
} | ||
var style = 'color: #ff6d00;font-size:11px;'; | ||
var text = "%c " + this.config.logPrefix + " " + metricName + " "; | ||
if (duration) { | ||
var durationMs = duration.toFixed(2); | ||
text += durationMs + " " + suffix; | ||
this.c.log(text, style); | ||
} | ||
else if (data) { | ||
this.c.log(text, style, data); | ||
} | ||
}; | ||
/** | ||
* Coloring Debugging Text in Browser Console | ||
*/ | ||
Perfume.prototype.logDebug = function (methodName, debugValue) { | ||
if (debugValue === void 0) { debugValue = ''; } | ||
if (!this.config.debugging) { | ||
return; | ||
} | ||
this.c.log(this.config.logPrefix + " debugging " + methodName + ":", debugValue); | ||
}; | ||
Perfume.prototype.logNavigationTiming = function () { | ||
var metricName = 'NavigationTiming'; | ||
var metricName = 'navigationTiming'; | ||
// Logs the metric in the internal console.log | ||
this.log({ metricName: metricName, data: this.navigationTiming, suffix: '' }); | ||
this.log({ metricName: metricName, data: this.getNavigationTiming(), suffix: '' }); | ||
// Sends the metric to an external tracking service | ||
this.sendTiming({ metricName: metricName, data: this.navigationTiming }); | ||
this.sendTiming({ metricName: metricName, data: this.getNavigationTiming() }); | ||
}; | ||
@@ -459,10 +394,78 @@ /** | ||
} | ||
window.console.warn(this.config.logPrefix, message); | ||
this.c.warn(this.config.logPrefix, message); | ||
}; | ||
/** | ||
* From visibilitychange listener it saves only when | ||
* the page gets hidden, because it's important to not | ||
* use the wrong "hidden" value when send timing or logging. | ||
*/ | ||
Perfume.prototype.onVisibilityChange = function () { | ||
if (typeof this.d.hidden !== 'undefined') { | ||
// Opera 12.10 and Firefox 18 and later support | ||
this.d.addEventListener('visibilitychange', this.didVisibilityChange); | ||
} | ||
}; | ||
Perfume.prototype.performanceMark = function (metricName, type) { | ||
var mark = "mark_" + metricName + "_" + type; | ||
this.wp.mark(mark); | ||
}; | ||
Perfume.prototype.performanceMeasure = function (metricName) { | ||
var startMark = "mark_" + metricName + "_start"; | ||
var endMark = "mark_" + metricName + "_end"; | ||
this.wp.measure(metricName, startMark, endMark); | ||
return this.getDurationByMetric(metricName); | ||
}; | ||
/** | ||
* PerformanceObserver subscribes to performance events as they happen | ||
* and respond to them asynchronously. | ||
*/ | ||
Perfume.prototype.performanceObserver = function (eventType, cb) { | ||
this.perfObserver = new PerformanceObserver(function (entryList) { | ||
var entries = entryList.getEntries(); | ||
cb(entries); | ||
}); | ||
// Retrieve buffered events and subscribe to newer events for Paint Timing | ||
this.perfObserver.observe({ type: eventType, buffered: true }); | ||
return this.perfObserver; | ||
}; | ||
/** | ||
* Logging Performance Paint Timing | ||
*/ | ||
Perfume.prototype.performanceObserverCb = function (options) { | ||
var _this = this; | ||
this.logDebug('PerformanceEntry', options); | ||
options.entries.forEach(function (performanceEntry) { | ||
_this.pushTask(function () { | ||
if (_this.config[options.metricName] && | ||
(!options.entryName || | ||
(options.entryName && performanceEntry.name === options.entryName))) { | ||
_this.logMetric(performanceEntry[options.valueLog], options.metricLog, options.metricName); | ||
} | ||
}); | ||
if (_this.perfObservers.firstContentfulPaint && | ||
performanceEntry.name === 'first-contentful-paint') { | ||
_this.perfObservers.firstContentfulPaint.disconnect(); | ||
} | ||
}); | ||
if (this.perfObservers.firstInputDelay && | ||
options.metricName === 'firstInputDelay') { | ||
this.perfObservers.firstInputDelay.disconnect(); | ||
} | ||
}; | ||
Perfume.prototype.performanceObserverResourceCb = function (options) { | ||
var _this = this; | ||
this.logDebug('PerformanceEntry:resource', options); | ||
options.entries.forEach(function (performanceEntry) { | ||
if (performanceEntry.decodedBodySize) { | ||
var decodedBodySize = parseFloat((performanceEntry.decodedBodySize / 1000).toFixed(2)); | ||
_this.dataConsumption += decodedBodySize; | ||
} | ||
}); | ||
}; | ||
/** | ||
* PushTask to requestIdleCallback | ||
*/ | ||
Perfume.prototype.pushTask = function (cb) { | ||
if ('requestIdleCallback' in window) { | ||
window.requestIdleCallback(cb, { timeout: 3000 }); | ||
if ('requestIdleCallback' in this.w) { | ||
this.w.requestIdleCallback(cb, { timeout: 3000 }); | ||
} | ||
@@ -473,2 +476,14 @@ else { | ||
}; | ||
/** | ||
* Sends the User timing measure to analyticsTracker | ||
*/ | ||
Perfume.prototype.sendTiming = function (options) { | ||
var metricName = options.metricName, data = options.data, duration = options.duration; | ||
// Doesn't send timing when page is hidden | ||
if (this.isHidden) { | ||
return; | ||
} | ||
// Send metric to custom Analytics service | ||
this.config.analyticsTracker({ metricName: metricName, data: data, duration: duration }); | ||
}; | ||
return Perfume; | ||
@@ -475,0 +490,0 @@ }()); |
@@ -1,2 +0,2 @@ | ||
var t=function(t,e,i){this.name=t,this.version=e,this.os=i},e=function(t){this.version=t,this.name="node",this.os=process.platform},i=function(){this.bot=!0,this.name="bot",this.version=null,this.os=null},n=3,r=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["vivaldi",/Vivaldi\/([0-9\.]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],o=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/],["Search Bot",/(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/]];function s(){return"undefined"!=typeof navigator?function(e){var s=""!==e&&r.reduce((function(t,i){var n=i[0],r=i[1];if(t)return t;var o=r.exec(e);return!!o&&[n,o]}),!1);if(!s)return null;var a=s[0],u=s[1];if("searchbot"===a)return new i;var f=u[1]&&u[1].split(/[._]/).slice(0,3);f?f.length<n&&(f=f.concat(new Array(n-f.length).fill("0"))):f=[];return new t(a,f.join("."),function(t){var e=o.find((function(e){e[0];return e[1].test(t)}));return e?e[0]:null}(e))}(navigator.userAgent):"undefined"!=typeof process&&process.version?new e(process.version.slice(1)):null}var a=function(){function t(){this.navigationTimingCached={}}return t.supported=function(){return window.performance&&!!performance.getEntriesByType&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!t.supported()||Object.keys(this.navigationTimingCached).length)return this.navigationTimingCached;var e=performance.getEntriesByType("navigation")[0];return e?(this.navigationTimingCached={fetchTime:parseFloat((e.responseEnd-e.fetchStart).toFixed(2)),workerTime:parseFloat((e.workerStart>0?e.responseEnd-e.workerStart:0).toFixed(2)),totalTime:parseFloat((e.responseEnd-e.requestStart).toFixed(2)),downloadTime:parseFloat((e.responseEnd-e.responseStart).toFixed(2)),timeToFirstByte:parseFloat((e.responseStart-e.requestStart).toFixed(2)),headerSize:parseFloat((e.transferSize-e.encodedBodySize).toFixed(2)),dnsLookupTime:parseFloat((e.domainLookupEnd-e.domainLookupStart).toFixed(2))},this.navigationTimingCached):this.navigationTimingCached},enumerable:!0,configurable:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,e){var i="mark_"+t+"_"+e;window.performance.mark(i)},t.prototype.measure=function(t,e){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.getDurationByMetric(t,e)},t.prototype.performanceObserver=function(t,e){return this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,e)),this.perfObserver.observe({type:t,buffered:!0}),this.perfObserver},t.prototype.getDurationByMetric=function(t,e){var i=this.getMeasurementForGivenName(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var e=window.performance.getEntriesByName(t);return e[e.length-1]},t.prototype.performanceObserverCb=function(t,e){t(e.getEntries())},t}(),u=function(){return(u=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},f=function(){function t(t){var e=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,analyticsTracker:function(t){},browserTracker:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,maxDataConsumption:2e4,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.dataConsumption=0,this.largestContentfulPaintDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics={},this.observers={},this.perfObservers={},this.didVisibilityChange=function(){document.hidden&&(e.isHidden=document.hidden)},this.config=Object.assign({},this.config,t),this.perf=new a,a.supported()&&(this.config.browserTracker&&(this.browser=s()),a.supportedPerformanceObserver()&&this.initPerformanceObserver(),this.onVisibilityChange(),this.config.navigationTiming&&this.logNavigationTiming())}return Object.defineProperty(t.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.perf.navigationTiming:{}},enumerable:!0,configurable:!0}),t.prototype.start=function(t){this.checkMetricName(t)&&a.supported()&&(this.metrics[t]?this.logWarn("Recording already started."):(this.metrics[t]={end:0,start:this.perf.now()},this.perf.mark(t,"start"),this.isHidden=!1))},t.prototype.end=function(t){var e=this;if(this.checkMetricName(t)&&a.supported()){var i=this.metrics[t];if(i){i.end=this.perf.now(),this.perf.mark(t,"end");var n=this.perf.measure(t,i),r=parseFloat(n.toFixed(2));return delete this.metrics[t],this.pushTask((function(){e.log({metricName:t,duration:r}),e.sendTiming({metricName:t,duration:r})})),r}this.logWarn("Recording already stopped.")}},t.prototype.endPaint=function(t){var e=this;return new Promise((function(i){setTimeout((function(){var n=e.end(t);i(n)}))}))},t.prototype.log=function(t){var e=u({suffix:"ms"},t),i=e.metricName,n=e.data,r=e.duration,o=e.suffix;if(!this.isHidden&&this.config.logging)if(i){var s="color: #ff6d00;font-size:11px;",a="%c "+this.config.logPrefix+" "+i+" ";if(r)a+=r.toFixed(2)+" "+o,window.console.log(a,s);else n&&window.console.log(a,s,n)}else this.logWarn(this.logMetricWarn)},t.prototype.logDebug=function(t,e){void 0===e&&(e=""),this.config.debugging&&window.console.log(this.config.logPrefix+" debugging "+t+":",e)},t.prototype.sendTiming=function(t){var e=t.metricName,i=t.data,n=t.duration;if(!this.isHidden){var r=this.config.browserTracker?this.browser:void 0;this.addBrowserToMetricName(e);this.config.analyticsTracker({metricName:e,data:i,duration:n,browser:r})}},t.prototype.initPerformanceObserver=function(){var t=this;(this.config.firstPaint||this.config.firstContentfulPaint)&&(this.observeFirstPaint=new Promise((function(e){t.logDebug("observeFirstPaint"),t.observers.firstPaint=e})),this.observeFirstContentfulPaint=new Promise((function(e){t.logDebug("observeFirstContentfulPaint"),t.observers.firstContentfulPaint=e,t.initFirstPaint()}))),this.observeFirstInputDelay=new Promise((function(e){t.observers.firstInputDelay=e,t.initFirstInputDelay()})),this.observeLargestContentfulPaint=new Promise((function(e){t.observers.largestContentfulPaint=e,t.initLargestContentfulPaint()})),this.config.dataConsumption&&(this.observeDataConsumption=new Promise((function(e){t.observers.dataConsumption=e,t.initDataConsumption()})))},t.prototype.addBrowserToMetricName=function(t){if(!this.config.browserTracker)return t;var e=t;this.browser.name&&(e+="."+this.browser.name.replace(/\s/g,""),this.browser.os&&(e+="."+this.browser.os.replace(/\s/g,"")));return e},t.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.logMetricWarn),!1)},t.prototype.performanceObserverCb=function(t){var e=this;this.logDebug("performanceObserverCb",t),t.entries.forEach((function(i){e.pushTask((function(){e.config[t.metricName]&&(!t.entryName||t.entryName&&i.name===t.entryName)&&e.logMetric(i[t.valueLog],t.metricLog,t.metricName)})),e.perfObservers.firstContentfulPaint&&"first-contentful-paint"===i.name&&e.perfObservers.firstContentfulPaint.disconnect()})),this.perfObservers.firstInputDelay&&"firstInputDelay"===t.metricName&&this.perfObservers.firstInputDelay.disconnect()},t.prototype.performanceObserverResourceCb=function(t){var e=this;this.logDebug("performanceObserverResourceCb",t),t.entries.forEach((function(t){if(t.decodedBodySize){var i=parseFloat((t.decodedBodySize/1e3).toFixed(2));e.dataConsumption+=i}}))},t.prototype.digestFirstPaintEntries=function(t){this.performanceObserverCb({entries:t,entryName:"first-paint",metricLog:"First Paint",metricName:"firstPaint",valueLog:"startTime"}),this.performanceObserverCb({entries:t,entryName:"first-contentful-paint",metricLog:"First Contentful Paint",metricName:"firstContentfulPaint",valueLog:"startTime"})},t.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint");try{this.perfObservers.firstContentfulPaint=this.perf.performanceObserver("paint",this.digestFirstPaintEntries.bind(this))}catch(t){this.logWarn("initFirstPaint failed")}},t.prototype.digestFirstInputDelayEntries=function(t){this.performanceObserverCb({entries:t,metricLog:"First Input Delay",metricName:"firstInputDelay",valueLog:"duration"}),this.config.largestContentfulPaint&&this.largestContentfulPaintDuration&&this.logMetric(this.largestContentfulPaintDuration,"Largest Contentful Paint","largestContentfulPaint"),this.disconnectDataConsumption()},t.prototype.digestLargestContentfulPaint=function(t){this.logDebug("digestLargestContentfulPaint",t);var e=t[t.length-1];this.largestContentfulPaintDuration=e.renderTime||e.loadTime},t.prototype.initFirstInputDelay=function(){try{this.perfObservers.firstInputDelay=this.perf.performanceObserver("first-input",this.digestFirstInputDelayEntries.bind(this))}catch(t){this.logWarn("initFirstInputDelay failed")}},t.prototype.initLargestContentfulPaint=function(){try{this.perfObservers.largestContentfulPaint=this.perf.performanceObserver("largest-contentful-paint",this.digestLargestContentfulPaint.bind(this))}catch(t){this.logWarn("initLargestContentfulPaint failed")}},t.prototype.digestDataConsumptionEntries=function(t){this.performanceObserverResourceCb({entries:t})},t.prototype.disconnectDataConsumption=function(){clearTimeout(this.dataConsumptionTimeout),this.perfObservers.dataConsumption&&this.dataConsumption&&(this.logMetric(this.dataConsumption,"Data Consumption","dataConsumption","Kb"),this.perfObservers.dataConsumption.disconnect())},t.prototype.initDataConsumption=function(){var t=this;try{this.perfObservers.dataConsumption=this.perf.performanceObserver("resource",this.digestDataConsumptionEntries.bind(this))}catch(t){this.logWarn("initDataConsumption failed")}this.dataConsumptionTimeout=setTimeout((function(){t.disconnectDataConsumption()}),15e3)},t.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},t.prototype.logMetric=function(t,e,i,n){void 0===n&&(n="ms");var r=parseFloat(t.toFixed(2));"dataConsumption"!==i&&r>this.config.maxMeasureTime||"dataConsumption"===i&&r>this.config.maxDataConsumption||("firstPaint"===i&&(this.firstPaintDuration=r),"firstContentfulPaint"===i&&(this.firstContentfulPaintDuration=r),"firstInputDelay"===i&&(this.firstInputDelayDuration=r),this.observers[i](r),this.log({metricName:e,duration:r,suffix:n}),this.sendTiming({metricName:i,duration:r}))},t.prototype.logNavigationTiming=function(){this.log({metricName:"NavigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({metricName:"NavigationTiming",data:this.navigationTiming})},t.prototype.logWarn=function(t){this.config.warning&&this.config.logging&&window.console.warn(this.config.logPrefix,t)},t.prototype.pushTask=function(t){"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:3e3}):t()},t}();export default f; | ||
var t=function(){return(t=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var e in i=arguments[n])Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}).apply(this,arguments)},i=function(){function i(t){var i=this;void 0===t&&(t={}),this.config={t:!1,i:!1,s:!1,h:!1,o:!1,navigationTiming:!1,u:function(t){},m:"Perfume.js:",l:!0,v:15e3,p:2e4,g:!1,P:!1},this.c=window.console,this.d=document,this.h=0,this.C=!1,this.F=0,this.T="Missing metric name",this.N="Recording already",this.L={},this.D={},this.k={},this.w=window,this.I=window.performance,this.O=function(){i.d.hidden&&(i.C=i.d.hidden)},this.config=Object.assign({},this.config,t),this._()&&(this.j()&&this.M(),this.q(),this.config.navigationTiming&&this.B())}return i.prototype.start=function(t){this.K(t)&&this._()&&(this.L[t]?this.R(this.N+" started."):(this.L[t]={end:0,start:this.I.now()},this.S(t,"start"),this.C=!1))},i.prototype.end=function(t){var i=this;if(this.K(t)&&this._()){var n=this.L[t];if(n){n.end=this.I.now(),this.S(t,"end");var s=this.A(t),e=parseFloat(s.toFixed(2));return delete this.L[t],this.G((function(){i.log({metricName:t,duration:e}),i.sendTiming({metricName:t,duration:e})})),e}this.R(this.N+" stopped.")}},i.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var s=i.end(t);n(s)}))}))},i.prototype.K=function(t){return!!t||(this.R(this.T),!1)},i.prototype.H=function(t){this.J({entries:t,U:"First Input Delay",metricName:"firstInputDelay",V:"duration"}),this.config.o&&this.F&&this.W(this.F,"Largest Contentful Paint","largestContentfulPaint"),this.X()},i.prototype.X=function(){clearTimeout(this.Y),this.k.h&&this.h&&(this.W(this.h,"Data Consumption","dataConsumption","Kb"),this.k.h.disconnect())},i.prototype.Z=function(){var t=this;try{this.k.h=this.$("resource",(function(i){t.tt({entries:i})}))}catch(t){this.R("DataConsumption:failed")}this.Y=setTimeout((function(){t.X()}),15e3)},i.prototype.it=function(){try{this.k.s=this.$("first-input",this.H.bind(this))}catch(t){this.R("FID:failed")}},i.prototype.nt=function(){var t=this;try{this.k.t=this.$("paint",(function(i){t.J({entries:i,st:"first-paint",U:"First Paint",metricName:"firstPaint",V:"startTime"}),t.J({entries:i,st:"first-contentful-paint",U:"First Contentful Paint",metricName:"firstContentfulPaint",V:"startTime"})}))}catch(t){this.R("FP:failed")}},i.prototype.et=function(){var t=this;try{this.k.o=this.$("largest-contentful-paint",(function(i){t.rt("PerformanceEntry:LCP",i);var n=i[i.length-1];t.F=n.at||n.ht}))}catch(t){this.R("LCP:failed")}},i.prototype.M=function(){(this.config.i||this.config.t)&&this.nt(),this.it(),this.et(),this.config.h&&this.Z()},i.prototype._=function(){return this.I&&!!this.I.getEntriesByType&&!!this.I.now&&!!this.I.mark},i.prototype.j=function(){return this.w.chrome&&"PerformanceObserver"in this.w},i.prototype.ot=function(t){var i=this.I.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},i.prototype.ut=function(){if(!this.config.navigationTiming)return{};if(!this._()||Object.keys(this.D).length)return this.D;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.D;var i=t.responseStart,n=t.responseEnd;return this.D={fetchTime:parseFloat((n-t.fetchStart).toFixed(2)),workerTime:parseFloat((t.ft>0?n-t.ft:0).toFixed(2)),totalTime:parseFloat((n-t.requestStart).toFixed(2)),downloadTime:parseFloat((n-i).toFixed(2)),timeToFirstByte:parseFloat((i-t.requestStart).toFixed(2)),headerSize:parseFloat((t.ct-t.lt).toFixed(2)),dnsLookupTime:parseFloat((t.domainLookupEnd-t.domainLookupStart).toFixed(2))},this.D},i.prototype.W=function(t,i,n,s){void 0===s&&(s="ms");var e=parseFloat(t.toFixed(2));"dataConsumption"!==n&&e>this.config.v||"dataConsumption"===n&&e>this.config.p||(this.log({metricName:i,duration:e,suffix:s}),this.sendTiming({metricName:n,duration:e}))},i.prototype.log=function(i){var n=t({suffix:"ms"},i),s=n.metricName,e=n.data,r=n.duration,a=n.suffix;if(!this.C&&this.config.l)if(s){var h="color: #ff6d00;font-size:11px;",o="%c "+this.config.m+" "+s+" ";if(r)o+=r.toFixed(2)+" "+a,this.c.log(o,h);else e&&this.c.log(o,h,e)}else this.R(this.T)},i.prototype.rt=function(t,i){void 0===i&&(i=""),this.config.P&&this.c.log(this.config.m+" debugging "+t+":",i)},i.prototype.B=function(){this.log({metricName:"navigationTiming",data:this.ut(),suffix:""}),this.sendTiming({metricName:"navigationTiming",data:this.ut()})},i.prototype.R=function(t){this.config.g&&this.config.l&&this.c.warn(this.config.m,t)},i.prototype.q=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.O)},i.prototype.S=function(t,i){var n="mark_"+t+"_"+i;this.I.mark(n)},i.prototype.A=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.I.measure(t,i,n),this.ot(t)},i.prototype.$=function(t,i){return this.dt=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.dt.observe({type:t,buffered:!0}),this.dt},i.prototype.J=function(t){var i=this;this.rt("PerformanceEntry",t),t.entries.forEach((function(n){i.G((function(){i.config[t.metricName]&&(!t.st||t.st&&n.name===t.st)&&i.W(n[t.V],t.U,t.metricName)})),i.k.t&&"first-contentful-paint"===n.name&&i.k.t.disconnect()})),this.k.s&&"firstInputDelay"===t.metricName&&this.k.s.disconnect()},i.prototype.tt=function(t){var i=this;this.rt("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.vt){var n=parseFloat((t.vt/1e3).toFixed(2));i.h+=n}}))},i.prototype.G=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},i.prototype.sendTiming=function(t){var i=t.metricName,n=t.data,s=t.duration;this.C||this.config.u({metricName:i,data:n,duration:s})},i}();export default i; | ||
//# sourceMappingURL=perfume.esm.min.js.map |
@@ -1,2 +0,2 @@ | ||
var Perfume=function(){"use strict";var t=function(t,e,i){this.name=t,this.version=e,this.os=i},e=function(t){this.version=t,this.name="node",this.os=process.platform},i=function(){this.bot=!0,this.name="bot",this.version=null,this.os=null},n=3,r=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["vivaldi",/Vivaldi\/([0-9\.]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],o=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/],["Search Bot",/(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/]];function s(){return"undefined"!=typeof navigator?function(e){var s=""!==e&&r.reduce((function(t,i){var n=i[0],r=i[1];if(t)return t;var o=r.exec(e);return!!o&&[n,o]}),!1);if(!s)return null;var a=s[0],u=s[1];if("searchbot"===a)return new i;var f=u[1]&&u[1].split(/[._]/).slice(0,3);f?f.length<n&&(f=f.concat(new Array(n-f.length).fill("0"))):f=[];return new t(a,f.join("."),function(t){var e=o.find((function(e){e[0];return e[1].test(t)}));return e?e[0]:null}(e))}(navigator.userAgent):"undefined"!=typeof process&&process.version?new e(process.version.slice(1)):null}var a=function(){function t(){this.navigationTimingCached={}}return t.supported=function(){return window.performance&&!!performance.getEntriesByType&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!t.supported()||Object.keys(this.navigationTimingCached).length)return this.navigationTimingCached;var e=performance.getEntriesByType("navigation")[0];return e?(this.navigationTimingCached={fetchTime:parseFloat((e.responseEnd-e.fetchStart).toFixed(2)),workerTime:parseFloat((e.workerStart>0?e.responseEnd-e.workerStart:0).toFixed(2)),totalTime:parseFloat((e.responseEnd-e.requestStart).toFixed(2)),downloadTime:parseFloat((e.responseEnd-e.responseStart).toFixed(2)),timeToFirstByte:parseFloat((e.responseStart-e.requestStart).toFixed(2)),headerSize:parseFloat((e.transferSize-e.encodedBodySize).toFixed(2)),dnsLookupTime:parseFloat((e.domainLookupEnd-e.domainLookupStart).toFixed(2))},this.navigationTimingCached):this.navigationTimingCached},enumerable:!0,configurable:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,e){var i="mark_"+t+"_"+e;window.performance.mark(i)},t.prototype.measure=function(t,e){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.getDurationByMetric(t,e)},t.prototype.performanceObserver=function(t,e){return this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,e)),this.perfObserver.observe({type:t,buffered:!0}),this.perfObserver},t.prototype.getDurationByMetric=function(t,e){var i=this.getMeasurementForGivenName(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var e=window.performance.getEntriesByName(t);return e[e.length-1]},t.prototype.performanceObserverCb=function(t,e){t(e.getEntries())},t}(),u=function(){return(u=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};return function(){function t(t){var e=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,analyticsTracker:function(t){},browserTracker:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,maxDataConsumption:2e4,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.dataConsumption=0,this.largestContentfulPaintDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics={},this.observers={},this.perfObservers={},this.didVisibilityChange=function(){document.hidden&&(e.isHidden=document.hidden)},this.config=Object.assign({},this.config,t),this.perf=new a,a.supported()&&(this.config.browserTracker&&(this.browser=s()),a.supportedPerformanceObserver()&&this.initPerformanceObserver(),this.onVisibilityChange(),this.config.navigationTiming&&this.logNavigationTiming())}return Object.defineProperty(t.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.perf.navigationTiming:{}},enumerable:!0,configurable:!0}),t.prototype.start=function(t){this.checkMetricName(t)&&a.supported()&&(this.metrics[t]?this.logWarn("Recording already started."):(this.metrics[t]={end:0,start:this.perf.now()},this.perf.mark(t,"start"),this.isHidden=!1))},t.prototype.end=function(t){var e=this;if(this.checkMetricName(t)&&a.supported()){var i=this.metrics[t];if(i){i.end=this.perf.now(),this.perf.mark(t,"end");var n=this.perf.measure(t,i),r=parseFloat(n.toFixed(2));return delete this.metrics[t],this.pushTask((function(){e.log({metricName:t,duration:r}),e.sendTiming({metricName:t,duration:r})})),r}this.logWarn("Recording already stopped.")}},t.prototype.endPaint=function(t){var e=this;return new Promise((function(i){setTimeout((function(){var n=e.end(t);i(n)}))}))},t.prototype.log=function(t){var e=u({suffix:"ms"},t),i=e.metricName,n=e.data,r=e.duration,o=e.suffix;if(!this.isHidden&&this.config.logging)if(i){var s="color: #ff6d00;font-size:11px;",a="%c "+this.config.logPrefix+" "+i+" ";if(r)a+=r.toFixed(2)+" "+o,window.console.log(a,s);else n&&window.console.log(a,s,n)}else this.logWarn(this.logMetricWarn)},t.prototype.logDebug=function(t,e){void 0===e&&(e=""),this.config.debugging&&window.console.log(this.config.logPrefix+" debugging "+t+":",e)},t.prototype.sendTiming=function(t){var e=t.metricName,i=t.data,n=t.duration;if(!this.isHidden){var r=this.config.browserTracker?this.browser:void 0;this.addBrowserToMetricName(e);this.config.analyticsTracker({metricName:e,data:i,duration:n,browser:r})}},t.prototype.initPerformanceObserver=function(){var t=this;(this.config.firstPaint||this.config.firstContentfulPaint)&&(this.observeFirstPaint=new Promise((function(e){t.logDebug("observeFirstPaint"),t.observers.firstPaint=e})),this.observeFirstContentfulPaint=new Promise((function(e){t.logDebug("observeFirstContentfulPaint"),t.observers.firstContentfulPaint=e,t.initFirstPaint()}))),this.observeFirstInputDelay=new Promise((function(e){t.observers.firstInputDelay=e,t.initFirstInputDelay()})),this.observeLargestContentfulPaint=new Promise((function(e){t.observers.largestContentfulPaint=e,t.initLargestContentfulPaint()})),this.config.dataConsumption&&(this.observeDataConsumption=new Promise((function(e){t.observers.dataConsumption=e,t.initDataConsumption()})))},t.prototype.addBrowserToMetricName=function(t){if(!this.config.browserTracker)return t;var e=t;this.browser.name&&(e+="."+this.browser.name.replace(/\s/g,""),this.browser.os&&(e+="."+this.browser.os.replace(/\s/g,"")));return e},t.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.logMetricWarn),!1)},t.prototype.performanceObserverCb=function(t){var e=this;this.logDebug("performanceObserverCb",t),t.entries.forEach((function(i){e.pushTask((function(){e.config[t.metricName]&&(!t.entryName||t.entryName&&i.name===t.entryName)&&e.logMetric(i[t.valueLog],t.metricLog,t.metricName)})),e.perfObservers.firstContentfulPaint&&"first-contentful-paint"===i.name&&e.perfObservers.firstContentfulPaint.disconnect()})),this.perfObservers.firstInputDelay&&"firstInputDelay"===t.metricName&&this.perfObservers.firstInputDelay.disconnect()},t.prototype.performanceObserverResourceCb=function(t){var e=this;this.logDebug("performanceObserverResourceCb",t),t.entries.forEach((function(t){if(t.decodedBodySize){var i=parseFloat((t.decodedBodySize/1e3).toFixed(2));e.dataConsumption+=i}}))},t.prototype.digestFirstPaintEntries=function(t){this.performanceObserverCb({entries:t,entryName:"first-paint",metricLog:"First Paint",metricName:"firstPaint",valueLog:"startTime"}),this.performanceObserverCb({entries:t,entryName:"first-contentful-paint",metricLog:"First Contentful Paint",metricName:"firstContentfulPaint",valueLog:"startTime"})},t.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint");try{this.perfObservers.firstContentfulPaint=this.perf.performanceObserver("paint",this.digestFirstPaintEntries.bind(this))}catch(t){this.logWarn("initFirstPaint failed")}},t.prototype.digestFirstInputDelayEntries=function(t){this.performanceObserverCb({entries:t,metricLog:"First Input Delay",metricName:"firstInputDelay",valueLog:"duration"}),this.config.largestContentfulPaint&&this.largestContentfulPaintDuration&&this.logMetric(this.largestContentfulPaintDuration,"Largest Contentful Paint","largestContentfulPaint"),this.disconnectDataConsumption()},t.prototype.digestLargestContentfulPaint=function(t){this.logDebug("digestLargestContentfulPaint",t);var e=t[t.length-1];this.largestContentfulPaintDuration=e.renderTime||e.loadTime},t.prototype.initFirstInputDelay=function(){try{this.perfObservers.firstInputDelay=this.perf.performanceObserver("first-input",this.digestFirstInputDelayEntries.bind(this))}catch(t){this.logWarn("initFirstInputDelay failed")}},t.prototype.initLargestContentfulPaint=function(){try{this.perfObservers.largestContentfulPaint=this.perf.performanceObserver("largest-contentful-paint",this.digestLargestContentfulPaint.bind(this))}catch(t){this.logWarn("initLargestContentfulPaint failed")}},t.prototype.digestDataConsumptionEntries=function(t){this.performanceObserverResourceCb({entries:t})},t.prototype.disconnectDataConsumption=function(){clearTimeout(this.dataConsumptionTimeout),this.perfObservers.dataConsumption&&this.dataConsumption&&(this.logMetric(this.dataConsumption,"Data Consumption","dataConsumption","Kb"),this.perfObservers.dataConsumption.disconnect())},t.prototype.initDataConsumption=function(){var t=this;try{this.perfObservers.dataConsumption=this.perf.performanceObserver("resource",this.digestDataConsumptionEntries.bind(this))}catch(t){this.logWarn("initDataConsumption failed")}this.dataConsumptionTimeout=setTimeout((function(){t.disconnectDataConsumption()}),15e3)},t.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},t.prototype.logMetric=function(t,e,i,n){void 0===n&&(n="ms");var r=parseFloat(t.toFixed(2));"dataConsumption"!==i&&r>this.config.maxMeasureTime||"dataConsumption"===i&&r>this.config.maxDataConsumption||("firstPaint"===i&&(this.firstPaintDuration=r),"firstContentfulPaint"===i&&(this.firstContentfulPaintDuration=r),"firstInputDelay"===i&&(this.firstInputDelayDuration=r),this.observers[i](r),this.log({metricName:e,duration:r,suffix:n}),this.sendTiming({metricName:i,duration:r}))},t.prototype.logNavigationTiming=function(){this.log({metricName:"NavigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({metricName:"NavigationTiming",data:this.navigationTiming})},t.prototype.logWarn=function(t){this.config.warning&&this.config.logging&&window.console.warn(this.config.logPrefix,t)},t.prototype.pushTask=function(t){"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:3e3}):t()},t}()}(); | ||
var Perfume=function(){"use strict";var t=function(){return(t=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var e in i=arguments[n])Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}).apply(this,arguments)};return function(){function i(t){var i=this;void 0===t&&(t={}),this.config={t:!1,i:!1,s:!1,h:!1,o:!1,navigationTiming:!1,u:function(t){},m:"Perfume.js:",l:!0,v:15e3,p:2e4,g:!1,P:!1},this.c=window.console,this.d=document,this.h=0,this.C=!1,this.F=0,this.T="Missing metric name",this.N="Recording already",this.L={},this.D={},this.k={},this.w=window,this.I=window.performance,this.O=function(){i.d.hidden&&(i.C=i.d.hidden)},this.config=Object.assign({},this.config,t),this._()&&(this.j()&&this.M(),this.q(),this.config.navigationTiming&&this.B())}return i.prototype.start=function(t){this.K(t)&&this._()&&(this.L[t]?this.R(this.N+" started."):(this.L[t]={end:0,start:this.I.now()},this.S(t,"start"),this.C=!1))},i.prototype.end=function(t){var i=this;if(this.K(t)&&this._()){var n=this.L[t];if(n){n.end=this.I.now(),this.S(t,"end");var s=this.A(t),e=parseFloat(s.toFixed(2));return delete this.L[t],this.G((function(){i.log({metricName:t,duration:e}),i.sendTiming({metricName:t,duration:e})})),e}this.R(this.N+" stopped.")}},i.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var s=i.end(t);n(s)}))}))},i.prototype.K=function(t){return!!t||(this.R(this.T),!1)},i.prototype.H=function(t){this.J({entries:t,U:"First Input Delay",metricName:"firstInputDelay",V:"duration"}),this.config.o&&this.F&&this.W(this.F,"Largest Contentful Paint","largestContentfulPaint"),this.X()},i.prototype.X=function(){clearTimeout(this.Y),this.k.h&&this.h&&(this.W(this.h,"Data Consumption","dataConsumption","Kb"),this.k.h.disconnect())},i.prototype.Z=function(){var t=this;try{this.k.h=this.$("resource",(function(i){t.tt({entries:i})}))}catch(t){this.R("DataConsumption:failed")}this.Y=setTimeout((function(){t.X()}),15e3)},i.prototype.it=function(){try{this.k.s=this.$("first-input",this.H.bind(this))}catch(t){this.R("FID:failed")}},i.prototype.nt=function(){var t=this;try{this.k.t=this.$("paint",(function(i){t.J({entries:i,st:"first-paint",U:"First Paint",metricName:"firstPaint",V:"startTime"}),t.J({entries:i,st:"first-contentful-paint",U:"First Contentful Paint",metricName:"firstContentfulPaint",V:"startTime"})}))}catch(t){this.R("FP:failed")}},i.prototype.et=function(){var t=this;try{this.k.o=this.$("largest-contentful-paint",(function(i){t.rt("PerformanceEntry:LCP",i);var n=i[i.length-1];t.F=n.at||n.ht}))}catch(t){this.R("LCP:failed")}},i.prototype.M=function(){(this.config.i||this.config.t)&&this.nt(),this.it(),this.et(),this.config.h&&this.Z()},i.prototype._=function(){return this.I&&!!this.I.getEntriesByType&&!!this.I.now&&!!this.I.mark},i.prototype.j=function(){return this.w.chrome&&"PerformanceObserver"in this.w},i.prototype.ot=function(t){var i=this.I.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},i.prototype.ut=function(){if(!this.config.navigationTiming)return{};if(!this._()||Object.keys(this.D).length)return this.D;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.D;var i=t.responseStart,n=t.responseEnd;return this.D={fetchTime:parseFloat((n-t.fetchStart).toFixed(2)),workerTime:parseFloat((t.ft>0?n-t.ft:0).toFixed(2)),totalTime:parseFloat((n-t.requestStart).toFixed(2)),downloadTime:parseFloat((n-i).toFixed(2)),timeToFirstByte:parseFloat((i-t.requestStart).toFixed(2)),headerSize:parseFloat((t.ct-t.lt).toFixed(2)),dnsLookupTime:parseFloat((t.domainLookupEnd-t.domainLookupStart).toFixed(2))},this.D},i.prototype.W=function(t,i,n,s){void 0===s&&(s="ms");var e=parseFloat(t.toFixed(2));"dataConsumption"!==n&&e>this.config.v||"dataConsumption"===n&&e>this.config.p||(this.log({metricName:i,duration:e,suffix:s}),this.sendTiming({metricName:n,duration:e}))},i.prototype.log=function(i){var n=t({suffix:"ms"},i),s=n.metricName,e=n.data,r=n.duration,a=n.suffix;if(!this.C&&this.config.l)if(s){var h="color: #ff6d00;font-size:11px;",o="%c "+this.config.m+" "+s+" ";if(r)o+=r.toFixed(2)+" "+a,this.c.log(o,h);else e&&this.c.log(o,h,e)}else this.R(this.T)},i.prototype.rt=function(t,i){void 0===i&&(i=""),this.config.P&&this.c.log(this.config.m+" debugging "+t+":",i)},i.prototype.B=function(){this.log({metricName:"navigationTiming",data:this.ut(),suffix:""}),this.sendTiming({metricName:"navigationTiming",data:this.ut()})},i.prototype.R=function(t){this.config.g&&this.config.l&&this.c.warn(this.config.m,t)},i.prototype.q=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.O)},i.prototype.S=function(t,i){var n="mark_"+t+"_"+i;this.I.mark(n)},i.prototype.A=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.I.measure(t,i,n),this.ot(t)},i.prototype.$=function(t,i){return this.dt=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.dt.observe({type:t,buffered:!0}),this.dt},i.prototype.J=function(t){var i=this;this.rt("PerformanceEntry",t),t.entries.forEach((function(n){i.G((function(){i.config[t.metricName]&&(!t.st||t.st&&n.name===t.st)&&i.W(n[t.V],t.U,t.metricName)})),i.k.t&&"first-contentful-paint"===n.name&&i.k.t.disconnect()})),this.k.s&&"firstInputDelay"===t.metricName&&this.k.s.disconnect()},i.prototype.tt=function(t){var i=this;this.rt("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.vt){var n=parseFloat((t.vt/1e3).toFixed(2));i.h+=n}}))},i.prototype.G=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},i.prototype.sendTiming=function(t){var i=t.metricName,n=t.data,s=t.duration;this.C||this.config.u({metricName:i,data:n,duration:s})},i}()}(); | ||
//# sourceMappingURL=perfume.iife.min.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";var BrowserInfo=function(t,e,i){this.name=t,this.version=e,this.os=i},NodeInfo=function(t){this.version=t,this.name="node",this.os=process.platform},BotInfo=function(){this.bot=!0,this.name="bot",this.version=null,this.os=null},SEARCHBOX_UA_REGEX=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,SEARCHBOT_OS_REGEX=/(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/,REQUIRED_VERSION_PARTS=3,userAgentRules=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["vivaldi",/Vivaldi\/([0-9\.]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["searchbot",SEARCHBOX_UA_REGEX]],operatingSystemRules=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/],["Search Bot",SEARCHBOT_OS_REGEX]];function detect(){return"undefined"!=typeof navigator?parseUserAgent(navigator.userAgent):getNodeVersion()}function parseUserAgent(t){var e=""!==t&&userAgentRules.reduce((function(e,i){var n=i[0],r=i[1];if(e)return e;var o=r.exec(t);return!!o&&[n,o]}),!1);if(!e)return null;var i=e[0],n=e[1];if("searchbot"===i)return new BotInfo;var r=n[1]&&n[1].split(/[._]/).slice(0,3);return r?r.length<REQUIRED_VERSION_PARTS&&(r=r.concat(new Array(REQUIRED_VERSION_PARTS-r.length).fill("0"))):r=[],new BrowserInfo(i,r.join("."),detectOS(t))}function detectOS(t){var e=operatingSystemRules.find((function(e){e[0];return e[1].test(t)}));return e?e[0]:null}function getNodeVersion(){return"undefined"!=typeof process&&process.version?new NodeInfo(process.version.slice(1)):null}var Performance=function(){function t(){this.navigationTimingCached={}}return t.supported=function(){return window.performance&&!!performance.getEntriesByType&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!t.supported()||Object.keys(this.navigationTimingCached).length)return this.navigationTimingCached;var e=performance.getEntriesByType("navigation")[0];return e?(this.navigationTimingCached={fetchTime:parseFloat((e.responseEnd-e.fetchStart).toFixed(2)),workerTime:parseFloat((e.workerStart>0?e.responseEnd-e.workerStart:0).toFixed(2)),totalTime:parseFloat((e.responseEnd-e.requestStart).toFixed(2)),downloadTime:parseFloat((e.responseEnd-e.responseStart).toFixed(2)),timeToFirstByte:parseFloat((e.responseStart-e.requestStart).toFixed(2)),headerSize:parseFloat((e.transferSize-e.encodedBodySize).toFixed(2)),dnsLookupTime:parseFloat((e.domainLookupEnd-e.domainLookupStart).toFixed(2))},this.navigationTimingCached):this.navigationTimingCached},enumerable:!0,configurable:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,e){var i="mark_"+t+"_"+e;window.performance.mark(i)},t.prototype.measure=function(t,e){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.getDurationByMetric(t,e)},t.prototype.performanceObserver=function(t,e){return this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,e)),this.perfObserver.observe({type:t,buffered:!0}),this.perfObserver},t.prototype.getDurationByMetric=function(t,e){var i=this.getMeasurementForGivenName(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var e=window.performance.getEntriesByName(t);return e[e.length-1]},t.prototype.performanceObserverCb=function(t,e){t(e.getEntries())},t}(),__assign=function(){return(__assign=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)},Perfume=function(){function t(t){var e=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,analyticsTracker:function(t){},browserTracker:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,maxDataConsumption:2e4,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.dataConsumption=0,this.largestContentfulPaintDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics={},this.observers={},this.perfObservers={},this.didVisibilityChange=function(){document.hidden&&(e.isHidden=document.hidden)},this.config=Object.assign({},this.config,t),this.perf=new Performance,Performance.supported()&&(this.config.browserTracker&&(this.browser=detect()),Performance.supportedPerformanceObserver()&&this.initPerformanceObserver(),this.onVisibilityChange(),this.config.navigationTiming&&this.logNavigationTiming())}return Object.defineProperty(t.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.perf.navigationTiming:{}},enumerable:!0,configurable:!0}),t.prototype.start=function(t){this.checkMetricName(t)&&Performance.supported()&&(this.metrics[t]?this.logWarn("Recording already started."):(this.metrics[t]={end:0,start:this.perf.now()},this.perf.mark(t,"start"),this.isHidden=!1))},t.prototype.end=function(t){var e=this;if(this.checkMetricName(t)&&Performance.supported()){var i=this.metrics[t];if(i){i.end=this.perf.now(),this.perf.mark(t,"end");var n=this.perf.measure(t,i),r=parseFloat(n.toFixed(2));return delete this.metrics[t],this.pushTask((function(){e.log({metricName:t,duration:r}),e.sendTiming({metricName:t,duration:r})})),r}this.logWarn("Recording already stopped.")}},t.prototype.endPaint=function(t){var e=this;return new Promise((function(i){setTimeout((function(){var n=e.end(t);i(n)}))}))},t.prototype.log=function(t){var e=__assign({suffix:"ms"},t),i=e.metricName,n=e.data,r=e.duration,o=e.suffix;if(!this.isHidden&&this.config.logging)if(i){var s="color: #ff6d00;font-size:11px;",a="%c "+this.config.logPrefix+" "+i+" ";if(r)a+=r.toFixed(2)+" "+o,window.console.log(a,s);else n&&window.console.log(a,s,n)}else this.logWarn(this.logMetricWarn)},t.prototype.logDebug=function(t,e){void 0===e&&(e=""),this.config.debugging&&window.console.log(this.config.logPrefix+" debugging "+t+":",e)},t.prototype.sendTiming=function(t){var e=t.metricName,i=t.data,n=t.duration;if(!this.isHidden){var r=this.config.browserTracker?this.browser:void 0;this.addBrowserToMetricName(e);this.config.analyticsTracker({metricName:e,data:i,duration:n,browser:r})}},t.prototype.initPerformanceObserver=function(){var t=this;(this.config.firstPaint||this.config.firstContentfulPaint)&&(this.observeFirstPaint=new Promise((function(e){t.logDebug("observeFirstPaint"),t.observers.firstPaint=e})),this.observeFirstContentfulPaint=new Promise((function(e){t.logDebug("observeFirstContentfulPaint"),t.observers.firstContentfulPaint=e,t.initFirstPaint()}))),this.observeFirstInputDelay=new Promise((function(e){t.observers.firstInputDelay=e,t.initFirstInputDelay()})),this.observeLargestContentfulPaint=new Promise((function(e){t.observers.largestContentfulPaint=e,t.initLargestContentfulPaint()})),this.config.dataConsumption&&(this.observeDataConsumption=new Promise((function(e){t.observers.dataConsumption=e,t.initDataConsumption()})))},t.prototype.addBrowserToMetricName=function(t){if(!this.config.browserTracker)return t;var e=t;this.browser.name&&(e+="."+this.browser.name.replace(/\s/g,""),this.browser.os&&(e+="."+this.browser.os.replace(/\s/g,"")));return e},t.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.logMetricWarn),!1)},t.prototype.performanceObserverCb=function(t){var e=this;this.logDebug("performanceObserverCb",t),t.entries.forEach((function(i){e.pushTask((function(){e.config[t.metricName]&&(!t.entryName||t.entryName&&i.name===t.entryName)&&e.logMetric(i[t.valueLog],t.metricLog,t.metricName)})),e.perfObservers.firstContentfulPaint&&"first-contentful-paint"===i.name&&e.perfObservers.firstContentfulPaint.disconnect()})),this.perfObservers.firstInputDelay&&"firstInputDelay"===t.metricName&&this.perfObservers.firstInputDelay.disconnect()},t.prototype.performanceObserverResourceCb=function(t){var e=this;this.logDebug("performanceObserverResourceCb",t),t.entries.forEach((function(t){if(t.decodedBodySize){var i=parseFloat((t.decodedBodySize/1e3).toFixed(2));e.dataConsumption+=i}}))},t.prototype.digestFirstPaintEntries=function(t){this.performanceObserverCb({entries:t,entryName:"first-paint",metricLog:"First Paint",metricName:"firstPaint",valueLog:"startTime"}),this.performanceObserverCb({entries:t,entryName:"first-contentful-paint",metricLog:"First Contentful Paint",metricName:"firstContentfulPaint",valueLog:"startTime"})},t.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint");try{this.perfObservers.firstContentfulPaint=this.perf.performanceObserver("paint",this.digestFirstPaintEntries.bind(this))}catch(t){this.logWarn("initFirstPaint failed")}},t.prototype.digestFirstInputDelayEntries=function(t){this.performanceObserverCb({entries:t,metricLog:"First Input Delay",metricName:"firstInputDelay",valueLog:"duration"}),this.config.largestContentfulPaint&&this.largestContentfulPaintDuration&&this.logMetric(this.largestContentfulPaintDuration,"Largest Contentful Paint","largestContentfulPaint"),this.disconnectDataConsumption()},t.prototype.digestLargestContentfulPaint=function(t){this.logDebug("digestLargestContentfulPaint",t);var e=t[t.length-1];this.largestContentfulPaintDuration=e.renderTime||e.loadTime},t.prototype.initFirstInputDelay=function(){try{this.perfObservers.firstInputDelay=this.perf.performanceObserver("first-input",this.digestFirstInputDelayEntries.bind(this))}catch(t){this.logWarn("initFirstInputDelay failed")}},t.prototype.initLargestContentfulPaint=function(){try{this.perfObservers.largestContentfulPaint=this.perf.performanceObserver("largest-contentful-paint",this.digestLargestContentfulPaint.bind(this))}catch(t){this.logWarn("initLargestContentfulPaint failed")}},t.prototype.digestDataConsumptionEntries=function(t){this.performanceObserverResourceCb({entries:t})},t.prototype.disconnectDataConsumption=function(){clearTimeout(this.dataConsumptionTimeout),this.perfObservers.dataConsumption&&this.dataConsumption&&(this.logMetric(this.dataConsumption,"Data Consumption","dataConsumption","Kb"),this.perfObservers.dataConsumption.disconnect())},t.prototype.initDataConsumption=function(){var t=this;try{this.perfObservers.dataConsumption=this.perf.performanceObserver("resource",this.digestDataConsumptionEntries.bind(this))}catch(t){this.logWarn("initDataConsumption failed")}this.dataConsumptionTimeout=setTimeout((function(){t.disconnectDataConsumption()}),15e3)},t.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},t.prototype.logMetric=function(t,e,i,n){void 0===n&&(n="ms");var r=parseFloat(t.toFixed(2));"dataConsumption"!==i&&r>this.config.maxMeasureTime||"dataConsumption"===i&&r>this.config.maxDataConsumption||("firstPaint"===i&&(this.firstPaintDuration=r),"firstContentfulPaint"===i&&(this.firstContentfulPaintDuration=r),"firstInputDelay"===i&&(this.firstInputDelayDuration=r),this.observers[i](r),this.log({metricName:e,duration:r,suffix:n}),this.sendTiming({metricName:i,duration:r}))},t.prototype.logNavigationTiming=function(){this.log({metricName:"NavigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({metricName:"NavigationTiming",data:this.navigationTiming})},t.prototype.logWarn=function(t){this.config.warning&&this.config.logging&&window.console.warn(this.config.logPrefix,t)},t.prototype.pushTask=function(t){"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:3e3}):t()},t}();module.exports=Perfume; | ||
"use strict";var __assign=function(){return(__assign=Object.assign||function(t){for(var i,s=1,n=arguments.length;s<n;s++)for(var e in i=arguments[s])Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}).apply(this,arguments)},Perfume=function(){function t(t){var i=this;void 0===t&&(t={}),this.config={t:!1,i:!1,s:!1,h:!1,o:!1,navigationTiming:!1,u:function(t){},m:"Perfume.js:",l:!0,v:15e3,g:2e4,p:!1,P:!1},this.c=window.console,this.d=document,this.h=0,this.C=!1,this.F=0,this.T="Missing metric name",this.N="Recording already",this._={},this.L={},this.D={},this.w=window,this.k=window.performance,this.I=function(){i.d.hidden&&(i.C=i.d.hidden)},this.config=Object.assign({},this.config,t),this.O()&&(this.j()&&this.M(),this.q(),this.config.navigationTiming&&this.B())}return t.prototype.start=function(t){this.K(t)&&this.O()&&(this._[t]?this.R(this.N+" started."):(this._[t]={end:0,start:this.k.now()},this.S(t,"start"),this.C=!1))},t.prototype.end=function(t){var i=this;if(this.K(t)&&this.O()){var s=this._[t];if(s){s.end=this.k.now(),this.S(t,"end");var n=this.A(t),e=parseFloat(n.toFixed(2));return delete this._[t],this.G((function(){i.log({metricName:t,duration:e}),i.sendTiming({metricName:t,duration:e})})),e}this.R(this.N+" stopped.")}},t.prototype.endPaint=function(t){var i=this;return new Promise((function(s){setTimeout((function(){var n=i.end(t);s(n)}))}))},t.prototype.K=function(t){return!!t||(this.R(this.T),!1)},t.prototype.H=function(t){this.J({entries:t,U:"First Input Delay",metricName:"firstInputDelay",V:"duration"}),this.config.o&&this.F&&this.W(this.F,"Largest Contentful Paint","largestContentfulPaint"),this.X()},t.prototype.X=function(){clearTimeout(this.Y),this.D.h&&this.h&&(this.W(this.h,"Data Consumption","dataConsumption","Kb"),this.D.h.disconnect())},t.prototype.Z=function(){var t=this;try{this.D.h=this.$("resource",(function(i){t.tt({entries:i})}))}catch(t){this.R("DataConsumption:failed")}this.Y=setTimeout((function(){t.X()}),15e3)},t.prototype.it=function(){try{this.D.s=this.$("first-input",this.H.bind(this))}catch(t){this.R("FID:failed")}},t.prototype.st=function(){var t=this;try{this.D.t=this.$("paint",(function(i){t.J({entries:i,nt:"first-paint",U:"First Paint",metricName:"firstPaint",V:"startTime"}),t.J({entries:i,nt:"first-contentful-paint",U:"First Contentful Paint",metricName:"firstContentfulPaint",V:"startTime"})}))}catch(t){this.R("FP:failed")}},t.prototype.et=function(){var t=this;try{this.D.o=this.$("largest-contentful-paint",(function(i){t.rt("PerformanceEntry:LCP",i);var s=i[i.length-1];t.F=s.at||s.ht}))}catch(t){this.R("LCP:failed")}},t.prototype.M=function(){(this.config.i||this.config.t)&&this.st(),this.it(),this.et(),this.config.h&&this.Z()},t.prototype.O=function(){return this.k&&!!this.k.getEntriesByType&&!!this.k.now&&!!this.k.mark},t.prototype.j=function(){return this.w.chrome&&"PerformanceObserver"in this.w},t.prototype.ot=function(t){var i=this.k.getEntriesByName(t),s=i[i.length-1];return s&&"measure"===s.entryType?s.duration:-1},t.prototype.ut=function(){if(!this.config.navigationTiming)return{};if(!this.O()||Object.keys(this.L).length)return this.L;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.L;var i=t.responseStart,s=t.responseEnd;return this.L={fetchTime:parseFloat((s-t.fetchStart).toFixed(2)),workerTime:parseFloat((t.ft>0?s-t.ft:0).toFixed(2)),totalTime:parseFloat((s-t.requestStart).toFixed(2)),downloadTime:parseFloat((s-i).toFixed(2)),timeToFirstByte:parseFloat((i-t.requestStart).toFixed(2)),headerSize:parseFloat((t.ct-t.lt).toFixed(2)),dnsLookupTime:parseFloat((t.domainLookupEnd-t.domainLookupStart).toFixed(2))},this.L},t.prototype.W=function(t,i,s,n){void 0===n&&(n="ms");var e=parseFloat(t.toFixed(2));"dataConsumption"!==s&&e>this.config.v||"dataConsumption"===s&&e>this.config.g||(this.log({metricName:i,duration:e,suffix:n}),this.sendTiming({metricName:s,duration:e}))},t.prototype.log=function(t){var i=__assign({suffix:"ms"},t),s=i.metricName,n=i.data,e=i.duration,r=i.suffix;if(!this.C&&this.config.l)if(s){var a="color: #ff6d00;font-size:11px;",h="%c "+this.config.m+" "+s+" ";if(e)h+=e.toFixed(2)+" "+r,this.c.log(h,a);else n&&this.c.log(h,a,n)}else this.R(this.T)},t.prototype.rt=function(t,i){void 0===i&&(i=""),this.config.P&&this.c.log(this.config.m+" debugging "+t+":",i)},t.prototype.B=function(){this.log({metricName:"navigationTiming",data:this.ut(),suffix:""}),this.sendTiming({metricName:"navigationTiming",data:this.ut()})},t.prototype.R=function(t){this.config.p&&this.config.l&&this.c.warn(this.config.m,t)},t.prototype.q=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.I)},t.prototype.S=function(t,i){var s="mark_"+t+"_"+i;this.k.mark(s)},t.prototype.A=function(t){var i="mark_"+t+"_start",s="mark_"+t+"_end";return this.k.measure(t,i,s),this.ot(t)},t.prototype.$=function(t,i){return this.dt=new PerformanceObserver((function(t){var s=t.getEntries();i(s)})),this.dt.observe({type:t,buffered:!0}),this.dt},t.prototype.J=function(t){var i=this;this.rt("PerformanceEntry",t),t.entries.forEach((function(s){i.G((function(){i.config[t.metricName]&&(!t.nt||t.nt&&s.name===t.nt)&&i.W(s[t.V],t.U,t.metricName)})),i.D.t&&"first-contentful-paint"===s.name&&i.D.t.disconnect()})),this.D.s&&"firstInputDelay"===t.metricName&&this.D.s.disconnect()},t.prototype.tt=function(t){var i=this;this.rt("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.vt){var s=parseFloat((t.vt/1e3).toFixed(2));i.h+=s}}))},t.prototype.G=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},t.prototype.sendTiming=function(t){var i=t.metricName,s=t.data,n=t.duration;this.C||this.config.u({metricName:i,data:s,duration:n})},t}();module.exports=Perfume; | ||
//# sourceMappingURL=perfume.min.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).Perfume=e()}(this,(function(){"use strict";var t=function(t,e,i){this.name=t,this.version=e,this.os=i},e=function(t){this.version=t,this.name="node",this.os=process.platform},i=function(){this.bot=!0,this.name="bot",this.version=null,this.os=null},n=3,r=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["vivaldi",/Vivaldi\/([0-9\.]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)$/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],o=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/],["Search Bot",/(nuhk)|(Googlebot)|(Yammybot)|(Openbot)|(Slurp)|(MSNBot)|(Ask Jeeves\/Teoma)|(ia_archiver)/]];function s(){return"undefined"!=typeof navigator?function(e){var s=""!==e&&r.reduce((function(t,i){var n=i[0],r=i[1];if(t)return t;var o=r.exec(e);return!!o&&[n,o]}),!1);if(!s)return null;var a=s[0],u=s[1];if("searchbot"===a)return new i;var f=u[1]&&u[1].split(/[._]/).slice(0,3);f?f.length<n&&(f=f.concat(new Array(n-f.length).fill("0"))):f=[];return new t(a,f.join("."),function(t){var e=o.find((function(e){e[0];return e[1].test(t)}));return e?e[0]:null}(e))}(navigator.userAgent):"undefined"!=typeof process&&process.version?new e(process.version.slice(1)):null}var a=function(){function t(){this.navigationTimingCached={}}return t.supported=function(){return window.performance&&!!performance.getEntriesByType&&!!performance.now&&!!performance.mark},t.supportedPerformanceObserver=function(){return window.chrome&&"PerformanceObserver"in window},Object.defineProperty(t.prototype,"navigationTiming",{get:function(){if(!t.supported()||Object.keys(this.navigationTimingCached).length)return this.navigationTimingCached;var e=performance.getEntriesByType("navigation")[0];return e?(this.navigationTimingCached={fetchTime:parseFloat((e.responseEnd-e.fetchStart).toFixed(2)),workerTime:parseFloat((e.workerStart>0?e.responseEnd-e.workerStart:0).toFixed(2)),totalTime:parseFloat((e.responseEnd-e.requestStart).toFixed(2)),downloadTime:parseFloat((e.responseEnd-e.responseStart).toFixed(2)),timeToFirstByte:parseFloat((e.responseStart-e.requestStart).toFixed(2)),headerSize:parseFloat((e.transferSize-e.encodedBodySize).toFixed(2)),dnsLookupTime:parseFloat((e.domainLookupEnd-e.domainLookupStart).toFixed(2))},this.navigationTimingCached):this.navigationTimingCached},enumerable:!0,configurable:!0}),t.prototype.now=function(){return window.performance.now()},t.prototype.mark=function(t,e){var i="mark_"+t+"_"+e;window.performance.mark(i)},t.prototype.measure=function(t,e){var i="mark_"+t+"_start",n="mark_"+t+"_end";return window.performance.measure(t,i,n),this.getDurationByMetric(t,e)},t.prototype.performanceObserver=function(t,e){return this.perfObserver=new PerformanceObserver(this.performanceObserverCb.bind(this,e)),this.perfObserver.observe({type:t,buffered:!0}),this.perfObserver},t.prototype.getDurationByMetric=function(t,e){var i=this.getMeasurementForGivenName(t);return i&&"measure"===i.entryType?i.duration:-1},t.prototype.getMeasurementForGivenName=function(t){var e=window.performance.getEntriesByName(t);return e[e.length-1]},t.prototype.performanceObserverCb=function(t,e){t(e.getEntries())},t}(),u=function(){return(u=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var r in e=arguments[i])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};return function(){function t(t){var e=this;void 0===t&&(t={}),this.config={firstContentfulPaint:!1,firstPaint:!1,firstInputDelay:!1,dataConsumption:!1,largestContentfulPaint:!1,navigationTiming:!1,analyticsTracker:function(t){},browserTracker:!1,logPrefix:"Perfume.js:",logging:!0,maxMeasureTime:15e3,maxDataConsumption:2e4,warning:!1,debugging:!1},this.firstPaintDuration=0,this.firstContentfulPaintDuration=0,this.firstInputDelayDuration=0,this.dataConsumption=0,this.largestContentfulPaintDuration=0,this.isHidden=!1,this.logMetricWarn="Please provide a metric name",this.metrics={},this.observers={},this.perfObservers={},this.didVisibilityChange=function(){document.hidden&&(e.isHidden=document.hidden)},this.config=Object.assign({},this.config,t),this.perf=new a,a.supported()&&(this.config.browserTracker&&(this.browser=s()),a.supportedPerformanceObserver()&&this.initPerformanceObserver(),this.onVisibilityChange(),this.config.navigationTiming&&this.logNavigationTiming())}return Object.defineProperty(t.prototype,"navigationTiming",{get:function(){return this.config.navigationTiming?this.perf.navigationTiming:{}},enumerable:!0,configurable:!0}),t.prototype.start=function(t){this.checkMetricName(t)&&a.supported()&&(this.metrics[t]?this.logWarn("Recording already started."):(this.metrics[t]={end:0,start:this.perf.now()},this.perf.mark(t,"start"),this.isHidden=!1))},t.prototype.end=function(t){var e=this;if(this.checkMetricName(t)&&a.supported()){var i=this.metrics[t];if(i){i.end=this.perf.now(),this.perf.mark(t,"end");var n=this.perf.measure(t,i),r=parseFloat(n.toFixed(2));return delete this.metrics[t],this.pushTask((function(){e.log({metricName:t,duration:r}),e.sendTiming({metricName:t,duration:r})})),r}this.logWarn("Recording already stopped.")}},t.prototype.endPaint=function(t){var e=this;return new Promise((function(i){setTimeout((function(){var n=e.end(t);i(n)}))}))},t.prototype.log=function(t){var e=u({suffix:"ms"},t),i=e.metricName,n=e.data,r=e.duration,o=e.suffix;if(!this.isHidden&&this.config.logging)if(i){var s="color: #ff6d00;font-size:11px;",a="%c "+this.config.logPrefix+" "+i+" ";if(r)a+=r.toFixed(2)+" "+o,window.console.log(a,s);else n&&window.console.log(a,s,n)}else this.logWarn(this.logMetricWarn)},t.prototype.logDebug=function(t,e){void 0===e&&(e=""),this.config.debugging&&window.console.log(this.config.logPrefix+" debugging "+t+":",e)},t.prototype.sendTiming=function(t){var e=t.metricName,i=t.data,n=t.duration;if(!this.isHidden){var r=this.config.browserTracker?this.browser:void 0;this.addBrowserToMetricName(e);this.config.analyticsTracker({metricName:e,data:i,duration:n,browser:r})}},t.prototype.initPerformanceObserver=function(){var t=this;(this.config.firstPaint||this.config.firstContentfulPaint)&&(this.observeFirstPaint=new Promise((function(e){t.logDebug("observeFirstPaint"),t.observers.firstPaint=e})),this.observeFirstContentfulPaint=new Promise((function(e){t.logDebug("observeFirstContentfulPaint"),t.observers.firstContentfulPaint=e,t.initFirstPaint()}))),this.observeFirstInputDelay=new Promise((function(e){t.observers.firstInputDelay=e,t.initFirstInputDelay()})),this.observeLargestContentfulPaint=new Promise((function(e){t.observers.largestContentfulPaint=e,t.initLargestContentfulPaint()})),this.config.dataConsumption&&(this.observeDataConsumption=new Promise((function(e){t.observers.dataConsumption=e,t.initDataConsumption()})))},t.prototype.addBrowserToMetricName=function(t){if(!this.config.browserTracker)return t;var e=t;this.browser.name&&(e+="."+this.browser.name.replace(/\s/g,""),this.browser.os&&(e+="."+this.browser.os.replace(/\s/g,"")));return e},t.prototype.checkMetricName=function(t){return!!t||(this.logWarn(this.logMetricWarn),!1)},t.prototype.performanceObserverCb=function(t){var e=this;this.logDebug("performanceObserverCb",t),t.entries.forEach((function(i){e.pushTask((function(){e.config[t.metricName]&&(!t.entryName||t.entryName&&i.name===t.entryName)&&e.logMetric(i[t.valueLog],t.metricLog,t.metricName)})),e.perfObservers.firstContentfulPaint&&"first-contentful-paint"===i.name&&e.perfObservers.firstContentfulPaint.disconnect()})),this.perfObservers.firstInputDelay&&"firstInputDelay"===t.metricName&&this.perfObservers.firstInputDelay.disconnect()},t.prototype.performanceObserverResourceCb=function(t){var e=this;this.logDebug("performanceObserverResourceCb",t),t.entries.forEach((function(t){if(t.decodedBodySize){var i=parseFloat((t.decodedBodySize/1e3).toFixed(2));e.dataConsumption+=i}}))},t.prototype.digestFirstPaintEntries=function(t){this.performanceObserverCb({entries:t,entryName:"first-paint",metricLog:"First Paint",metricName:"firstPaint",valueLog:"startTime"}),this.performanceObserverCb({entries:t,entryName:"first-contentful-paint",metricLog:"First Contentful Paint",metricName:"firstContentfulPaint",valueLog:"startTime"})},t.prototype.initFirstPaint=function(){this.logDebug("initFirstPaint");try{this.perfObservers.firstContentfulPaint=this.perf.performanceObserver("paint",this.digestFirstPaintEntries.bind(this))}catch(t){this.logWarn("initFirstPaint failed")}},t.prototype.digestFirstInputDelayEntries=function(t){this.performanceObserverCb({entries:t,metricLog:"First Input Delay",metricName:"firstInputDelay",valueLog:"duration"}),this.config.largestContentfulPaint&&this.largestContentfulPaintDuration&&this.logMetric(this.largestContentfulPaintDuration,"Largest Contentful Paint","largestContentfulPaint"),this.disconnectDataConsumption()},t.prototype.digestLargestContentfulPaint=function(t){this.logDebug("digestLargestContentfulPaint",t);var e=t[t.length-1];this.largestContentfulPaintDuration=e.renderTime||e.loadTime},t.prototype.initFirstInputDelay=function(){try{this.perfObservers.firstInputDelay=this.perf.performanceObserver("first-input",this.digestFirstInputDelayEntries.bind(this))}catch(t){this.logWarn("initFirstInputDelay failed")}},t.prototype.initLargestContentfulPaint=function(){try{this.perfObservers.largestContentfulPaint=this.perf.performanceObserver("largest-contentful-paint",this.digestLargestContentfulPaint.bind(this))}catch(t){this.logWarn("initLargestContentfulPaint failed")}},t.prototype.digestDataConsumptionEntries=function(t){this.performanceObserverResourceCb({entries:t})},t.prototype.disconnectDataConsumption=function(){clearTimeout(this.dataConsumptionTimeout),this.perfObservers.dataConsumption&&this.dataConsumption&&(this.logMetric(this.dataConsumption,"Data Consumption","dataConsumption","Kb"),this.perfObservers.dataConsumption.disconnect())},t.prototype.initDataConsumption=function(){var t=this;try{this.perfObservers.dataConsumption=this.perf.performanceObserver("resource",this.digestDataConsumptionEntries.bind(this))}catch(t){this.logWarn("initDataConsumption failed")}this.dataConsumptionTimeout=setTimeout((function(){t.disconnectDataConsumption()}),15e3)},t.prototype.onVisibilityChange=function(){void 0!==document.hidden&&document.addEventListener("visibilitychange",this.didVisibilityChange)},t.prototype.logMetric=function(t,e,i,n){void 0===n&&(n="ms");var r=parseFloat(t.toFixed(2));"dataConsumption"!==i&&r>this.config.maxMeasureTime||"dataConsumption"===i&&r>this.config.maxDataConsumption||("firstPaint"===i&&(this.firstPaintDuration=r),"firstContentfulPaint"===i&&(this.firstContentfulPaintDuration=r),"firstInputDelay"===i&&(this.firstInputDelayDuration=r),this.observers[i](r),this.log({metricName:e,duration:r,suffix:n}),this.sendTiming({metricName:i,duration:r}))},t.prototype.logNavigationTiming=function(){this.log({metricName:"NavigationTiming",data:this.navigationTiming,suffix:""}),this.sendTiming({metricName:"NavigationTiming",data:this.navigationTiming})},t.prototype.logWarn=function(t){this.config.warning&&this.config.logging&&window.console.warn(this.config.logPrefix,t)},t.prototype.pushTask=function(t){"requestIdleCallback"in window?window.requestIdleCallback(t,{timeout:3e3}):t()},t}()})); | ||
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):(t=t||self).t=i()}(this,(function(){"use strict";var t=function(){return(t=Object.assign||function(t){for(var i,n=1,s=arguments.length;n<s;n++)for(var e in i=arguments[n])Object.prototype.hasOwnProperty.call(i,e)&&(t[e]=i[e]);return t}).apply(this,arguments)};return function(){function i(t){var i=this;void 0===t&&(t={}),this.config={i:!1,s:!1,h:!1,o:!1,u:!1,navigationTiming:!1,m:function(t){},l:"Perfume.js:",v:!0,p:15e3,g:2e4,P:!1,C:!1},this.c=window.console,this.d=document,this.o=0,this.F=!1,this.T=0,this.N="Missing metric name",this.L="Recording already",this.D={},this.k={},this.j={},this.w=window,this.I=window.performance,this.O=function(){i.d.hidden&&(i.F=i.d.hidden)},this.config=Object.assign({},this.config,t),this._()&&(this.M()&&this.q(),this.B(),this.config.navigationTiming&&this.K())}return i.prototype.start=function(t){this.R(t)&&this._()&&(this.D[t]?this.S(this.L+" started."):(this.D[t]={end:0,start:this.I.now()},this.A(t,"start"),this.F=!1))},i.prototype.end=function(t){var i=this;if(this.R(t)&&this._()){var n=this.D[t];if(n){n.end=this.I.now(),this.A(t,"end");var s=this.G(t),e=parseFloat(s.toFixed(2));return delete this.D[t],this.H((function(){i.log({metricName:t,duration:e}),i.sendTiming({metricName:t,duration:e})})),e}this.S(this.L+" stopped.")}},i.prototype.endPaint=function(t){var i=this;return new Promise((function(n){setTimeout((function(){var s=i.end(t);n(s)}))}))},i.prototype.R=function(t){return!!t||(this.S(this.N),!1)},i.prototype.J=function(t){this.U({entries:t,V:"First Input Delay",metricName:"firstInputDelay",W:"duration"}),this.config.u&&this.T&&this.X(this.T,"Largest Contentful Paint","largestContentfulPaint"),this.Y()},i.prototype.Y=function(){clearTimeout(this.Z),this.j.o&&this.o&&(this.X(this.o,"Data Consumption","dataConsumption","Kb"),this.j.o.disconnect())},i.prototype.$=function(){var t=this;try{this.j.o=this.tt("resource",(function(i){t.it({entries:i})}))}catch(t){this.S("DataConsumption:failed")}this.Z=setTimeout((function(){t.Y()}),15e3)},i.prototype.nt=function(){try{this.j.h=this.tt("first-input",this.J.bind(this))}catch(t){this.S("FID:failed")}},i.prototype.st=function(){var t=this;try{this.j.i=this.tt("paint",(function(i){t.U({entries:i,et:"first-paint",V:"First Paint",metricName:"firstPaint",W:"startTime"}),t.U({entries:i,et:"first-contentful-paint",V:"First Contentful Paint",metricName:"firstContentfulPaint",W:"startTime"})}))}catch(t){this.S("FP:failed")}},i.prototype.rt=function(){var t=this;try{this.j.u=this.tt("largest-contentful-paint",(function(i){t.at("PerformanceEntry:LCP",i);var n=i[i.length-1];t.T=n.ht||n.ot}))}catch(t){this.S("LCP:failed")}},i.prototype.q=function(){(this.config.s||this.config.i)&&this.st(),this.nt(),this.rt(),this.config.o&&this.$()},i.prototype._=function(){return this.I&&!!this.I.getEntriesByType&&!!this.I.now&&!!this.I.mark},i.prototype.M=function(){return this.w.chrome&&"PerformanceObserver"in this.w},i.prototype.ut=function(t){var i=this.I.getEntriesByName(t),n=i[i.length-1];return n&&"measure"===n.entryType?n.duration:-1},i.prototype.ft=function(){if(!this.config.navigationTiming)return{};if(!this._()||Object.keys(this.k).length)return this.k;var t=performance.getEntriesByType("navigation")[0];if(!t)return this.k;var i=t.responseStart,n=t.responseEnd;return this.k={fetchTime:parseFloat((n-t.fetchStart).toFixed(2)),workerTime:parseFloat((t.ct>0?n-t.ct:0).toFixed(2)),totalTime:parseFloat((n-t.requestStart).toFixed(2)),downloadTime:parseFloat((n-i).toFixed(2)),timeToFirstByte:parseFloat((i-t.requestStart).toFixed(2)),headerSize:parseFloat((t.lt-t.dt).toFixed(2)),dnsLookupTime:parseFloat((t.domainLookupEnd-t.domainLookupStart).toFixed(2))},this.k},i.prototype.X=function(t,i,n,s){void 0===s&&(s="ms");var e=parseFloat(t.toFixed(2));"dataConsumption"!==n&&e>this.config.p||"dataConsumption"===n&&e>this.config.g||(this.log({metricName:i,duration:e,suffix:s}),this.sendTiming({metricName:n,duration:e}))},i.prototype.log=function(i){var n=t({suffix:"ms"},i),s=n.metricName,e=n.data,r=n.duration,a=n.suffix;if(!this.F&&this.config.v)if(s){var h="color: #ff6d00;font-size:11px;",o="%c "+this.config.l+" "+s+" ";if(r)o+=r.toFixed(2)+" "+a,this.c.log(o,h);else e&&this.c.log(o,h,e)}else this.S(this.N)},i.prototype.at=function(t,i){void 0===i&&(i=""),this.config.C&&this.c.log(this.config.l+" debugging "+t+":",i)},i.prototype.K=function(){this.log({metricName:"navigationTiming",data:this.ft(),suffix:""}),this.sendTiming({metricName:"navigationTiming",data:this.ft()})},i.prototype.S=function(t){this.config.P&&this.config.v&&this.c.warn(this.config.l,t)},i.prototype.B=function(){void 0!==this.d.hidden&&this.d.addEventListener("visibilitychange",this.O)},i.prototype.A=function(t,i){var n="mark_"+t+"_"+i;this.I.mark(n)},i.prototype.G=function(t){var i="mark_"+t+"_start",n="mark_"+t+"_end";return this.I.measure(t,i,n),this.ut(t)},i.prototype.tt=function(t,i){return this.vt=new PerformanceObserver((function(t){var n=t.getEntries();i(n)})),this.vt.observe({type:t,buffered:!0}),this.vt},i.prototype.U=function(t){var i=this;this.at("PerformanceEntry",t),t.entries.forEach((function(n){i.H((function(){i.config[t.metricName]&&(!t.et||t.et&&n.name===t.et)&&i.X(n[t.W],t.V,t.metricName)})),i.j.i&&"first-contentful-paint"===n.name&&i.j.i.disconnect()})),this.j.h&&"firstInputDelay"===t.metricName&&this.j.h.disconnect()},i.prototype.it=function(t){var i=this;this.at("PerformanceEntry:resource",t),t.entries.forEach((function(t){if(t.pt){var n=parseFloat((t.pt/1e3).toFixed(2));i.o+=n}}))},i.prototype.H=function(t){"requestIdleCallback"in this.w?this.w.requestIdleCallback(t,{timeout:3e3}):t()},i.prototype.sendTiming=function(t){var i=t.metricName,n=t.data,s=t.duration;this.F||this.config.m({metricName:i,data:n,duration:s})},i}()})); | ||
//# sourceMappingURL=perfume.umd.min.js.map |
/*! | ||
* Perfume.js v3.2.1 (http://zizzamia.github.io/perfume) | ||
* Perfume.js v4.0.0-rc.10 (http://zizzamia.github.io/perfume) | ||
* Copyright 2018 The Perfume Authors (https://github.com/Zizzamia/perfume.js/graphs/contributors) | ||
@@ -7,4 +7,2 @@ * Licensed under MIT (https://github.com/Zizzamia/perfume.js/blob/master/LICENSE) | ||
*/ | ||
import { BrowserInfo } from './detect-browser'; | ||
import { IMetricEntry, IPerfumeNavigationTiming } from './performance'; | ||
export interface IAnalyticsTrackerOptions { | ||
@@ -14,3 +12,2 @@ metricName: string; | ||
duration?: number; | ||
browser?: BrowserInfo | any; | ||
} | ||
@@ -25,3 +22,2 @@ export interface IPerfumeConfig { | ||
analyticsTracker: (options: IAnalyticsTrackerOptions) => void; | ||
browserTracker?: boolean; | ||
logPrefix: string; | ||
@@ -42,3 +38,2 @@ logging: boolean; | ||
analyticsTracker?: (options: IAnalyticsTrackerOptions) => void; | ||
browserTracker?: boolean; | ||
logPrefix?: string; | ||
@@ -57,8 +52,9 @@ logging?: boolean; | ||
} | ||
export interface IMetricEntry { | ||
start: number; | ||
end: number; | ||
} | ||
export interface IMetricMap { | ||
[metricName: string]: IMetricEntry; | ||
} | ||
export interface IObservers { | ||
[metricName: string]: any; | ||
} | ||
export interface IPerfObservers { | ||
@@ -73,24 +69,50 @@ [metricName: string]: any; | ||
export declare type IPerfumeMetrics = 'firstContentfulPaint' | 'firstPaint' | 'firstInputDelay'; | ||
export declare type IPerformanceObserverType = 'first-input' | 'largest-contentful-paint' | 'longtask' | 'measure' | 'navigation' | 'paint' | 'resource'; | ||
export declare type IPerformanceEntryInitiatorType = 'css' | 'fetch' | 'img' | 'other' | 'script' | 'xmlhttprequest'; | ||
export declare interface IPerformanceEntry { | ||
decodedBodySize?: number; | ||
duration: number; | ||
entryType: IPerformanceObserverType; | ||
initiatorType?: IPerformanceEntryInitiatorType; | ||
loadTime: number; | ||
name: string; | ||
renderTime: number; | ||
startTime: number; | ||
} | ||
export interface IPerformancePaintTiming { | ||
name: string; | ||
entryType: string; | ||
startTime: number; | ||
duration: number; | ||
} | ||
export interface IPerformanceObserver { | ||
observer: () => void; | ||
disconnect: () => void; | ||
} | ||
export interface IPerfumeNavigationTiming { | ||
fetchTime?: number; | ||
workerTime?: number; | ||
totalTime?: number; | ||
downloadTime?: number; | ||
timeToFirstByte?: number; | ||
headerSize?: number; | ||
dnsLookupTime?: number; | ||
} | ||
export default class Perfume { | ||
config: IPerfumeConfig; | ||
firstPaintDuration: number; | ||
firstContentfulPaintDuration: number; | ||
firstInputDelayDuration: number; | ||
dataConsumption: number; | ||
largestContentfulPaintDuration: number; | ||
observeFirstPaint?: Promise<number>; | ||
observeFirstContentfulPaint?: Promise<number>; | ||
observeFirstInputDelay?: Promise<number>; | ||
observeLargestContentfulPaint?: Promise<number>; | ||
observeDataConsumption?: Promise<number>; | ||
private browser; | ||
private c; | ||
private d; | ||
private dataConsumption; | ||
private dataConsumptionTimeout; | ||
private isHidden; | ||
private largestContentfulPaintDuration; | ||
private logMetricWarn; | ||
private logPrefixRecording; | ||
private metrics; | ||
private observers; | ||
private perf; | ||
private navigationTimingCached; | ||
private perfObserver; | ||
private perfObservers; | ||
private w; | ||
private wp; | ||
constructor(options?: IPerfumeOptions); | ||
readonly navigationTiming: IPerfumeNavigationTiming; | ||
/** | ||
@@ -108,53 +130,55 @@ * Start performance measurement | ||
endPaint(metricName: string): Promise<void | number>; | ||
private checkMetricName; | ||
private didVisibilityChange; | ||
private digestFirstInputDelayEntries; | ||
private disconnectDataConsumption; | ||
private initDataConsumption; | ||
private initFirstInputDelay; | ||
/** | ||
* Coloring Text in Browser Console | ||
* First Paint is essentially the paint after which | ||
* the biggest above-the-fold layout change has happened. | ||
*/ | ||
log(options: ILogOptions): void; | ||
private initFirstPaint; | ||
private initLargestContentfulPaint; | ||
private initPerformanceObserver; | ||
/** | ||
* Coloring Debugging Text in Browser Console | ||
* 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 | ||
*/ | ||
logDebug(methodName: string, debugValue?: any): void; | ||
private isPerformanceSupported; | ||
/** | ||
* Sends the User timing measure to analyticsTracker | ||
* For now only Chrome fully support the PerformanceObserver interface | ||
* and the entryType "paint". | ||
* Firefox 58: https://bugzilla.mozilla.org/show_bug.cgi?id=1403027 | ||
*/ | ||
sendTiming(options: ISendTimingOptions): void; | ||
private initPerformanceObserver; | ||
private addBrowserToMetricName; | ||
private checkMetricName; | ||
private didVisibilityChange; | ||
private isPerformanceObserverSupported; | ||
/** | ||
* Logging Performance Paint Timing | ||
* Get the duration of the timing metric or -1 if there a measurement has | ||
* not been made by the User Timing API | ||
*/ | ||
private performanceObserverCb; | ||
private performanceObserverResourceCb; | ||
private digestFirstPaintEntries; | ||
private getDurationByMetric; | ||
/** | ||
* First Paint is essentially the paint after which | ||
* the biggest above-the-fold layout change has happened. | ||
* Navigation Timing API provides performance metrics for HTML documents. | ||
* w3c.github.io/navigation-timing/ | ||
* developers.google.com/web/fundamentals/performance/navigation-and-resource-timing | ||
*/ | ||
private initFirstPaint; | ||
private digestFirstInputDelayEntries; | ||
private getNavigationTiming; | ||
/** | ||
* Update `lcp` to the latest value, using `renderTime` if it's available, | ||
* otherwise using `loadTime`. (Note: `renderTime` may not be available if | ||
* the element is an image and it's loaded cross-origin without the | ||
* `Timing-Allow-Origin` header.) | ||
* Dispatches the metric duration into internal logs | ||
* and the external time tracking service. | ||
*/ | ||
private digestLargestContentfulPaint; | ||
private initFirstInputDelay; | ||
private initLargestContentfulPaint; | ||
private digestDataConsumptionEntries; | ||
private disconnectDataConsumption; | ||
private initDataConsumption; | ||
private logMetric; | ||
/** | ||
* From visibilitychange listener it saves only when | ||
* the page gets hidden, because it's important to not | ||
* use the wrong "hidden" value when send timing or logging. | ||
* Coloring Text in Browser Console | ||
*/ | ||
private onVisibilityChange; | ||
private log; | ||
/** | ||
* Dispatches the metric duration into internal logs | ||
* and the external time tracking service. | ||
* Coloring Debugging Text in Browser Console | ||
*/ | ||
private logMetric; | ||
private logDebug; | ||
private logNavigationTiming; | ||
@@ -167,5 +191,27 @@ /** | ||
/** | ||
* From visibilitychange listener it saves only when | ||
* the page gets hidden, because it's important to not | ||
* use the wrong "hidden" value when send timing or logging. | ||
*/ | ||
private onVisibilityChange; | ||
private performanceMark; | ||
private performanceMeasure; | ||
/** | ||
* PerformanceObserver subscribes to performance events as they happen | ||
* and respond to them asynchronously. | ||
*/ | ||
private performanceObserver; | ||
/** | ||
* Logging Performance Paint Timing | ||
*/ | ||
private performanceObserverCb; | ||
private performanceObserverResourceCb; | ||
/** | ||
* PushTask to requestIdleCallback | ||
*/ | ||
private pushTask; | ||
/** | ||
* Sends the User timing measure to analyticsTracker | ||
*/ | ||
private sendTiming; | ||
} |
{ | ||
"name": "perfume.js", | ||
"version": "3.2.1", | ||
"version": "4.0.0-rc.10", | ||
"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.", | ||
@@ -64,3 +64,2 @@ "keywords": [ | ||
"/docs/", | ||
"detect-browser.ts", | ||
"/node_modules/" | ||
@@ -78,3 +77,2 @@ ], | ||
"/docs/", | ||
"detect-browser.ts", | ||
"/node_modules/", | ||
@@ -85,6 +83,6 @@ "/test/" | ||
"global": { | ||
"branches": 96, | ||
"functions": 96, | ||
"lines": 96, | ||
"statements": 96 | ||
"branches": 92, | ||
"functions": 92, | ||
"lines": 92, | ||
"statements": 92 | ||
} | ||
@@ -94,18 +92,15 @@ }, | ||
}, | ||
"dependencies": { | ||
"detect-browser": "4.5.1" | ||
}, | ||
"devDependencies": { | ||
"@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", | ||
@@ -115,11 +110,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" | ||
} | ||
} |
@@ -5,3 +5,3 @@ <a href="http://www.perfumejs.com/"> | ||
# [Perfume.js v3.2.1](http://perfumejs.com) | ||
# [Perfume.js v4.0.0](http://perfumejs.com) | ||
@@ -167,3 +167,2 @@ [](https://www.npmjs.org/package/perfume.js) [](https://travis-ci.org/Zizzamia/perfume.js) [](https://www.npmjs.org/package/perfume.js) [](https://codeclimate.com/github/Zizzamia/perfume.js/test_coverage) [](https://unpkg.com/perfume.js) | ||
const duration = perfume.end('fibonacci'); | ||
perfume.log({ metricName: 'Custom logging', duration }); | ||
// 🍹 HayesValley.js: Custom logging 0.14 ms | ||
@@ -170,0 +169,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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
-100%347699
-28.62%41
-19.61%2058
-27.2%3
50%392
-0.25%1
Infinity%- Removed
- Removed