web-stability-observer 1.3.4 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +2 -2
- package/dist/index.esm.js +2 -2
- package/dist/index.min.js +2 -2
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* web-stability-observer v1.3.
|
|
2
|
+
* web-stability-observer v1.3.5
|
|
3
3
|
* (c) 2024-2026 Vue Community Contributor
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
"use strict";class e{constructor(){this.value=0,this.entries=[],this.init()}init(){if("undefined"==typeof PerformanceObserver)return;new PerformanceObserver(e=>{for(const
|
|
6
|
+
"use strict";class e{constructor(){this.value=0,this.entries=[],this.init()}init(){if("undefined"==typeof PerformanceObserver)return;new PerformanceObserver(e=>{for(const r of e.getEntries())r.hadRecentInput||(this.value+=r.value,this.entries.push(r))}).observe({type:"layout-shift",buffered:!0})}getCLS(){return{value:this.value,entries:this.entries}}}class r{constructor(){this.jsErrors=[],this.resourceErrors=[],this.init()}init(){window.addEventListener("error",e=>{var r,s;const t=e.target;!t||"IMG"!==t.tagName&&"SCRIPT"!==t.tagName&&"LINK"!==t.tagName?this.jsErrors.push({type:(null===(r=e.error)||void 0===r?void 0:r.name)||"Unknown",message:e.message,stack:null===(s=e.error)||void 0===s?void 0:s.stack}):this.resourceErrors.push({type:"ResourceError",src:t.src||t.href,tagName:t.tagName})},!0),window.addEventListener("unhandledrejection",e=>{var r,s;this.jsErrors.push({type:"UnhandledRejection",message:(null===(r=e.reason)||void 0===r?void 0:r.message)||e.reason+"",stack:null===(s=e.reason)||void 0===s?void 0:s.stack})})}getErrors(){return{jsErrors:this.jsErrors,resourceErrors:this.resourceErrors}}}module.exports=class{constructor(s){this.config=Object.assign({threshold:.1,autoReport:!0,enableErrorTracking:!0},s),this.clsMonitor=new e,this.errorMonitor=new r,this.registerLifecycle()}analyze(){const{value:e,entries:r}=this.clsMonitor.getCLS(),{jsErrors:s,resourceErrors:t}=this.errorMonitor.getErrors();return{cls:e,clsEntries:r,jsErrors:s,resourceErrors:t,isStable:e<=(this.config.threshold||.1)&&0===s.length&&0===t.length,timestamp:Date.now(),url:window.location.href}}registerLifecycle(){this.config.autoReport&&this.config.reportUrl&&document.addEventListener("visibilitychange",()=>{if("hidden"===document.visibilityState){const e=this.analyze();((e,r)=>{if(navigator.sendBeacon){const s=new Blob([JSON.stringify(r)],{type:"application/json; charset=UTF-8"});navigator.sendBeacon(e,s)}else fetch(e,{method:"POST",body:JSON.stringify(r),keepalive:!0,headers:{"Content-Type":"application/json"}}).catch(console.error)})(this.config.reportUrl,e)}})}};
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* web-stability-observer v1.3.
|
|
2
|
+
* web-stability-observer v1.3.5
|
|
3
3
|
* (c) 2024-2026 Vue Community Contributor
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
class e{constructor(){this.value=0,this.entries=[],this.init()}init(){if("undefined"==typeof PerformanceObserver)return;new PerformanceObserver(e=>{for(const
|
|
6
|
+
class e{constructor(){this.value=0,this.entries=[],this.init()}init(){if("undefined"==typeof PerformanceObserver)return;new PerformanceObserver(e=>{for(const r of e.getEntries())r.hadRecentInput||(this.value+=r.value,this.entries.push(r))}).observe({type:"layout-shift",buffered:!0})}getCLS(){return{value:this.value,entries:this.entries}}}class r{constructor(){this.jsErrors=[],this.resourceErrors=[],this.init()}init(){window.addEventListener("error",e=>{var r,s;const t=e.target;!t||"IMG"!==t.tagName&&"SCRIPT"!==t.tagName&&"LINK"!==t.tagName?this.jsErrors.push({type:(null===(r=e.error)||void 0===r?void 0:r.name)||"Unknown",message:e.message,stack:null===(s=e.error)||void 0===s?void 0:s.stack}):this.resourceErrors.push({type:"ResourceError",src:t.src||t.href,tagName:t.tagName})},!0),window.addEventListener("unhandledrejection",e=>{var r,s;this.jsErrors.push({type:"UnhandledRejection",message:(null===(r=e.reason)||void 0===r?void 0:r.message)||e.reason+"",stack:null===(s=e.reason)||void 0===s?void 0:s.stack})})}getErrors(){return{jsErrors:this.jsErrors,resourceErrors:this.resourceErrors}}}class s{constructor(s){this.config=Object.assign({threshold:.1,autoReport:!0,enableErrorTracking:!0},s),this.clsMonitor=new e,this.errorMonitor=new r,this.registerLifecycle()}analyze(){const{value:e,entries:r}=this.clsMonitor.getCLS(),{jsErrors:s,resourceErrors:t}=this.errorMonitor.getErrors();return{cls:e,clsEntries:r,jsErrors:s,resourceErrors:t,isStable:e<=(this.config.threshold||.1)&&0===s.length&&0===t.length,timestamp:Date.now(),url:window.location.href}}registerLifecycle(){this.config.autoReport&&this.config.reportUrl&&document.addEventListener("visibilitychange",()=>{if("hidden"===document.visibilityState){const e=this.analyze();((e,r)=>{if(navigator.sendBeacon){const s=new Blob([JSON.stringify(r)],{type:"application/json; charset=UTF-8"});navigator.sendBeacon(e,s)}else fetch(e,{method:"POST",body:JSON.stringify(r),keepalive:!0,headers:{"Content-Type":"application/json"}}).catch(console.error)})(this.config.reportUrl,e)}})}}export{s as default};
|
package/dist/index.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* web-stability-observer v1.3.
|
|
2
|
+
* web-stability-observer v1.3.5
|
|
3
3
|
* (c) 2024-2026 Vue Community Contributor
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
!function(e,
|
|
6
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).SessionTracker=r()}(this,function(){"use strict";class e{constructor(){this.value=0,this.entries=[],this.init()}init(){"undefined"!=typeof PerformanceObserver&&new PerformanceObserver(e=>{for(const r of e.getEntries())r.hadRecentInput||(this.value+=r.value,this.entries.push(r))}).observe({type:"layout-shift",buffered:!0})}getCLS(){return{value:this.value,entries:this.entries}}}class r{constructor(){this.jsErrors=[],this.resourceErrors=[],this.init()}init(){window.addEventListener("error",e=>{var r,t;const s=e.target;!s||"IMG"!==s.tagName&&"SCRIPT"!==s.tagName&&"LINK"!==s.tagName?this.jsErrors.push({type:(null===(r=e.error)||void 0===r?void 0:r.name)||"Unknown",message:e.message,stack:null===(t=e.error)||void 0===t?void 0:t.stack}):this.resourceErrors.push({type:"ResourceError",src:s.src||s.href,tagName:s.tagName})},!0),window.addEventListener("unhandledrejection",e=>{var r,t;this.jsErrors.push({type:"UnhandledRejection",message:(null===(r=e.reason)||void 0===r?void 0:r.message)||e.reason+"",stack:null===(t=e.reason)||void 0===t?void 0:t.stack})})}getErrors(){return{jsErrors:this.jsErrors,resourceErrors:this.resourceErrors}}}return class{constructor(t){this.config=Object.assign({threshold:.1,autoReport:!0,enableErrorTracking:!0},t),this.clsMonitor=new e,this.errorMonitor=new r,this.registerLifecycle()}analyze(){const{value:e,entries:r}=this.clsMonitor.getCLS(),{jsErrors:t,resourceErrors:s}=this.errorMonitor.getErrors();return{cls:e,clsEntries:r,jsErrors:t,resourceErrors:s,isStable:e<=(this.config.threshold||.1)&&0===t.length&&0===s.length,timestamp:Date.now(),url:window.location.href}}registerLifecycle(){this.config.autoReport&&this.config.reportUrl&&document.addEventListener("visibilitychange",()=>{if("hidden"===document.visibilityState){const e=this.analyze();((e,r)=>{if(navigator.sendBeacon){const t=new Blob([JSON.stringify(r)],{type:"application/json; charset=UTF-8"});navigator.sendBeacon(e,t)}else fetch(e,{method:"POST",body:JSON.stringify(r),keepalive:!0,headers:{"Content-Type":"application/json"}}).catch(console.error)})(this.config.reportUrl,e)}})}}});
|