@yorkjs/web-error
Advanced tools
Comparing version 1.0.1 to 1.0.2
/** | ||
* web-error.js v1.0.1 | ||
* web-error.js v1.0.2 | ||
* (c) 2021-2022 shushu2013 | ||
@@ -41,10 +41,2 @@ * Released under the MIT License. | ||
try { | ||
const msgObj = { | ||
url: location.href, | ||
type: WINDOW_ERROR, | ||
error: event.message, | ||
file: event.filename, | ||
line: event.lineno, | ||
column: event.colno, | ||
}; | ||
// 只上报资源类型的错误 | ||
@@ -54,2 +46,11 @@ const target = event.target || event.srcElement; | ||
if (isHTMLElement) { | ||
const targetURL = target.href; | ||
const msgObj = { | ||
url: location.href, | ||
type: WINDOW_ERROR, | ||
error: event.message || targetURL, | ||
file: event.filename || targetURL, | ||
line: event.lineno, | ||
column: event.colno, | ||
}; | ||
config.reportError(msgObj); | ||
@@ -103,5 +104,5 @@ } | ||
*/ | ||
const version = "1.0.1"; | ||
const version = "1.0.2"; | ||
export { init, sendBeacon, sendImage, version }; | ||
//# sourceMappingURL=web-error.esm.js.map |
@@ -1,2 +0,2 @@ | ||
function n(n,o){let r=new Image;r.onload=r.onerror=function(){r=r.onload=r.onerror=null},r.src=`${n}?${o}`}function o(n,o){navigator.sendBeacon(n,o)}function r(n){!function(n){const o=window.onerror;window.onerror=function(r,e,t,c,i){o&&o(r,e,t,c,i);try{const o={url:location.href,type:1,error:r.toString(),file:e,line:t,column:c};n.reportError(o)}catch(n){}return!1},window.addEventListener("error",(function(o){try{const r={url:location.href,type:2,error:o.message,file:o.filename,line:o.lineno,column:o.colno},e=o.target||o.srcElement;e&&e instanceof HTMLElement&&n.reportError(r)}catch(n){}}),!0)}(n)}const e="1.0.1";export{r as init,o as sendBeacon,n as sendImage,e as version}; | ||
function n(n,o){let r=new Image;r.onload=r.onerror=function(){r=r.onload=r.onerror=null},r.src=`${n}?${o}`}function o(n,o){navigator.sendBeacon(n,o)}function r(n){!function(n){const o=window.onerror;window.onerror=function(r,e,t,c,i){o&&o(r,e,t,c,i);try{const o={url:location.href,type:1,error:r.toString(),file:e,line:t,column:c};n.reportError(o)}catch(n){}return!1},window.addEventListener("error",(function(o){try{const r=o.target||o.srcElement;if(r&&r instanceof HTMLElement){const e=r.href,t={url:location.href,type:2,error:o.message||e,file:o.filename||e,line:o.lineno,column:o.colno};n.reportError(t)}}catch(n){}}),!0)}(n)}const e="1.0.2";export{r as init,o as sendBeacon,n as sendImage,e as version}; | ||
//# sourceMappingURL=web-error.esm.min.js.map |
/** | ||
* web-error.js v1.0.1 | ||
* web-error.js v1.0.2 | ||
* (c) 2021-2022 shushu2013 | ||
@@ -47,10 +47,2 @@ * Released under the MIT License. | ||
try { | ||
var msgObj = { | ||
url: location.href, | ||
type: WINDOW_ERROR, | ||
error: event.message, | ||
file: event.filename, | ||
line: event.lineno, | ||
column: event.colno, | ||
}; | ||
// 只上报资源类型的错误 | ||
@@ -60,2 +52,11 @@ var target = event.target || event.srcElement; | ||
if (isHTMLElement) { | ||
var targetURL = target.href; | ||
var msgObj = { | ||
url: location.href, | ||
type: WINDOW_ERROR, | ||
error: event.message || targetURL, | ||
file: event.filename || targetURL, | ||
line: event.lineno, | ||
column: event.colno, | ||
}; | ||
config.reportError(msgObj); | ||
@@ -109,3 +110,3 @@ } | ||
*/ | ||
var version = "1.0.1"; | ||
var version = "1.0.2"; | ||
@@ -112,0 +113,0 @@ exports.init = init; |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).Url={})}(this,(function(e){"use strict";e.init=function(e){!function(e){var n=window.onerror;window.onerror=function(o,r,t,i,l){n&&n(o,r,t,i,l);try{var c={url:location.href,type:1,error:o.toString(),file:r,line:t,column:i};e.reportError(c)}catch(e){}return!1},window.addEventListener("error",(function(n){try{var o={url:location.href,type:2,error:n.message,file:n.filename,line:n.lineno,column:n.colno},r=n.target||n.srcElement;r&&r instanceof HTMLElement&&e.reportError(o)}catch(e){}}),!0)}(e)},e.sendBeacon=function(e,n){navigator.sendBeacon(e,n)},e.sendImage=function(e,n){var o=new Image;o.onload=o.onerror=function(){o=o.onload=o.onerror=null},o.src=e+"?"+n},e.version="1.0.1",Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).Url={})}(this,(function(e){"use strict";e.init=function(e){!function(e){var n=window.onerror;window.onerror=function(o,r,t,i,f){n&&n(o,r,t,i,f);try{var l={url:location.href,type:1,error:o.toString(),file:r,line:t,column:i};e.reportError(l)}catch(e){}return!1},window.addEventListener("error",(function(n){try{var o=n.target||n.srcElement;if(o&&o instanceof HTMLElement){var r=o.href,t={url:location.href,type:2,error:n.message||r,file:n.filename||r,line:n.lineno,column:n.colno};e.reportError(t)}}catch(e){}}),!0)}(e)},e.sendBeacon=function(e,n){navigator.sendBeacon(e,n)},e.sendImage=function(e,n){var o=new Image;o.onload=o.onerror=function(){o=o.onload=o.onerror=null},o.src=e+"?"+n},e.version="1.0.2",Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=web-error.min.js.map |
{ | ||
"name": "@yorkjs/web-error", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "process web-error and report tool", | ||
@@ -5,0 +5,0 @@ "main": "dist/web-error.js", |
@@ -8,2 +8,2 @@ import { Config } from './type'; | ||
*/ | ||
export declare const version = "1.0.1"; | ||
export declare const version = "1.0.2"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13073
244