@yorkjs/web-error
Advanced tools
Comparing version 1.0.3 to 1.0.4
/** | ||
* web-error.js v1.0.3 | ||
* web-error.js v1.0.4 | ||
* (c) 2021-2022 shushu2013 | ||
@@ -16,3 +16,3 @@ * Released under the MIT License. | ||
if (isHTMLElement) { | ||
const targetURL = target.href; | ||
const targetURL = target.href || target.src; | ||
const msgObj = { | ||
@@ -60,2 +60,6 @@ url: location.href, | ||
}; | ||
// 忽略 Script error. 错误 | ||
if (config.ignoreScriptError && msgObj.error === 'Script error.') { | ||
return false; | ||
} | ||
config.reportError(msgObj); | ||
@@ -99,5 +103,5 @@ } | ||
*/ | ||
const version = "1.0.3"; | ||
const version = "1.0.4"; | ||
export { init, sendBeacon, sendImage, version }; | ||
//# sourceMappingURL=web-error.esm.js.map |
@@ -1,2 +0,2 @@ | ||
function n(n){const o=function(o){!function(n,o){try{const r=n.target||n.srcElement;if(r&&r instanceof HTMLElement){const e=r.href,t={url:location.href,type:2,error:n.message||e,file:n.filename||e,line:n.lineno,column:n.colno};o.reportError(t)}}catch(n){}}(o,n)},r=window.onerror;window.onerror=function(o,e,t,c,i){r&&r(o,e,t,c,i);try{const r={url:location.href,type:1,error:o.toString(),file:e,line:t,column:c};n.reportError(r)}catch(n){}return!1},window.addEventListener?window.addEventListener("error",o,!0):window.attachEvent&&window.attachEvent("onerror",o)}function o(n,o){let r=new Image;r.onload=r.onerror=function(){r=r.onload=r.onerror=null},r.src=`${n}?${o}`}function r(n,o){navigator.sendBeacon(n,o)}function e(o){n(o)}const t="1.0.3";export{e as init,r as sendBeacon,o as sendImage,t as version}; | ||
function r(r){const n=function(n){!function(r,n){try{const o=r.target||r.srcElement;if(o&&o instanceof HTMLElement){const e=o.href||o.src,t={url:location.href,type:2,error:r.message||e,file:r.filename||e,line:r.lineno,column:r.colno};n.reportError(t)}}catch(r){}}(n,r)},o=window.onerror;window.onerror=function(n,e,t,i,c){o&&o(n,e,t,i,c);try{const o={url:location.href,type:1,error:n.toString(),file:e,line:t,column:i};if(r.ignoreScriptError&&"Script error."===o.error)return!1;r.reportError(o)}catch(r){}return!1},window.addEventListener?window.addEventListener("error",n,!0):window.attachEvent&&window.attachEvent("onerror",n)}function n(r,n){let o=new Image;o.onload=o.onerror=function(){o=o.onload=o.onerror=null},o.src=`${r}?${n}`}function o(r,n){navigator.sendBeacon(r,n)}function e(n){r(n)}const t="1.0.4";export{e as init,o as sendBeacon,n as sendImage,t as version}; | ||
//# sourceMappingURL=web-error.esm.min.js.map |
/** | ||
* web-error.js v1.0.3 | ||
* web-error.js v1.0.4 | ||
* (c) 2021-2022 shushu2013 | ||
@@ -22,3 +22,3 @@ * Released under the MIT License. | ||
if (isHTMLElement) { | ||
var targetURL = target.href; | ||
var targetURL = target.href || target.src; | ||
var msgObj = { | ||
@@ -66,2 +66,6 @@ url: location.href, | ||
}; | ||
// 忽略 Script error. 错误 | ||
if (config.ignoreScriptError && msgObj.error === 'Script error.') { | ||
return false; | ||
} | ||
config.reportError(msgObj); | ||
@@ -105,3 +109,3 @@ } | ||
*/ | ||
var version = "1.0.3"; | ||
var version = "1.0.4"; | ||
@@ -108,0 +112,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";function n(e){var n=function(n){!function(e,n){try{var o=e.target||e.srcElement;if(o&&o instanceof HTMLElement){var r=o.href,t={url:location.href,type:2,error:e.message||r,file:e.filename||r,line:e.lineno,column:e.colno};n.reportError(t)}}catch(e){}}(n,e)},o=window.onerror;window.onerror=function(n,r,t,i,a){o&&o(n,r,t,i,a);try{var c={url:location.href,type:1,error:n.toString(),file:r,line:t,column:i};e.reportError(c)}catch(e){}return!1},window.addEventListener?window.addEventListener("error",n,!0):window.attachEvent&&window.attachEvent("onerror",n)}e.init=function(e){n(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.3",Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).Url={})}(this,(function(e){"use strict";function r(e){var r=function(r){!function(e,r){try{var n=e.target||e.srcElement;if(n&&n instanceof HTMLElement){var o=n.href||n.src,t={url:location.href,type:2,error:e.message||o,file:e.filename||o,line:e.lineno,column:e.colno};r.reportError(t)}}catch(e){}}(r,e)},n=window.onerror;window.onerror=function(r,o,t,i,c){n&&n(r,o,t,i,c);try{var a={url:location.href,type:1,error:r.toString(),file:o,line:t,column:i};if(e.ignoreScriptError&&"Script error."===a.error)return!1;e.reportError(a)}catch(e){}return!1},window.addEventListener?window.addEventListener("error",r,!0):window.attachEvent&&window.attachEvent("onerror",r)}e.init=function(e){r(e)},e.sendBeacon=function(e,r){navigator.sendBeacon(e,r)},e.sendImage=function(e,r){var n=new Image;n.onload=n.onerror=function(){n=n.onload=n.onerror=null},n.src=e+"?"+r},e.version="1.0.4",Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=web-error.min.js.map |
{ | ||
"name": "@yorkjs/web-error", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"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.3"; | ||
export declare const version = "1.0.4"; |
@@ -15,3 +15,4 @@ declare global { | ||
export interface Config { | ||
ignoreScriptError?: boolean; | ||
reportError: (err: ErrorMsg) => void; | ||
} |
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
13156
250