@yorkjs/web-error
Advanced tools
Comparing version 1.0.5 to 1.0.6
/** | ||
* web-error.js v1.0.5 | ||
* web-error.js v1.0.6 | ||
* (c) 2021-2022 shushu2013 | ||
@@ -9,2 +9,3 @@ * Released under the MIT License. | ||
const WINDOW_ERROR = 2; | ||
const UNHANDLED_REJECTION = 3; | ||
@@ -76,2 +77,16 @@ function catchListenerError(event, config) { | ||
true); | ||
// 捕获 promsie 错误 | ||
window.addEventListener('unhandledrejection', function (event) { | ||
try { | ||
const msgObj = { | ||
url: location.href, | ||
type: UNHANDLED_REJECTION, | ||
error: JSON.stringify(event.reason), | ||
file: location.href, | ||
}; | ||
config.reportError(msgObj); | ||
} | ||
catch (err) { | ||
} | ||
}); | ||
} | ||
@@ -103,5 +118,5 @@ // 兼容 IE 8 | ||
*/ | ||
const version = "1.0.5"; | ||
const version = "1.0.6"; | ||
export { init, sendBeacon, sendImage, version }; | ||
//# sourceMappingURL=web-error.esm.js.map |
@@ -1,2 +0,2 @@ | ||
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.ignoreCrossScriptError&&"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.5";export{e as init,o as sendBeacon,n 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.ignoreCrossScriptError&&"Script error."===o.error)return!1;r.reportError(o)}catch(r){}return!1},window.addEventListener?(window.addEventListener("error",n,!0),window.addEventListener("unhandledrejection",(function(n){try{const o={url:location.href,type:3,error:JSON.stringify(n.reason),file:location.href};r.reportError(o)}catch(r){}}))):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.6";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.5 | ||
* web-error.js v1.0.6 | ||
* (c) 2021-2022 shushu2013 | ||
@@ -15,2 +15,3 @@ * Released under the MIT License. | ||
var WINDOW_ERROR = 2; | ||
var UNHANDLED_REJECTION = 3; | ||
@@ -82,2 +83,16 @@ function catchListenerError(event, config) { | ||
true); | ||
// 捕获 promsie 错误 | ||
window.addEventListener('unhandledrejection', function (event) { | ||
try { | ||
var msgObj = { | ||
url: location.href, | ||
type: UNHANDLED_REJECTION, | ||
error: JSON.stringify(event.reason), | ||
file: location.href, | ||
}; | ||
config.reportError(msgObj); | ||
} | ||
catch (err) { | ||
} | ||
}); | ||
} | ||
@@ -109,3 +124,3 @@ // 兼容 IE 8 | ||
*/ | ||
var version = "1.0.5"; | ||
var version = "1.0.6"; | ||
@@ -112,0 +127,0 @@ exports.init = init; |
@@ -1,2 +0,2 @@ | ||
!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.ignoreCrossScriptError&&"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.5",Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((r="undefined"!=typeof globalThis?globalThis:r||self).Url={})}(this,(function(r){"use strict";function e(r){var e=function(e){!function(r,e){try{var n=r.target||r.srcElement;if(n&&n instanceof HTMLElement){var o=n.href||n.src,t={url:location.href,type:2,error:r.message||o,file:r.filename||o,line:r.lineno,column:r.colno};e.reportError(t)}}catch(r){}}(e,r)},n=window.onerror;window.onerror=function(e,o,t,i,c){n&&n(e,o,t,i,c);try{var a={url:location.href,type:1,error:e.toString(),file:o,line:t,column:i};if(r.ignoreCrossScriptError&&"Script error."===a.error)return!1;r.reportError(a)}catch(r){}return!1},window.addEventListener?(window.addEventListener("error",e,!0),window.addEventListener("unhandledrejection",(function(e){try{var n={url:location.href,type:3,error:JSON.stringify(e.reason),file:location.href};r.reportError(n)}catch(r){}}))):window.attachEvent&&window.attachEvent("onerror",e)}r.init=function(r){e(r)},r.sendBeacon=function(r,e){navigator.sendBeacon(r,e)},r.sendImage=function(r,e){var n=new Image;n.onload=n.onerror=function(){n=n.onload=n.onerror=null},n.src=r+"?"+e},r.version="1.0.6",Object.defineProperty(r,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=web-error.min.js.map |
{ | ||
"name": "@yorkjs/web-error", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "process web-error and report tool", | ||
@@ -5,0 +5,0 @@ "main": "dist/web-error.js", |
export declare const WINDOW_ONERROR = 1; | ||
export declare const WINDOW_ERROR = 2; | ||
export declare const UNHANDLED_REJECTION = 3; |
@@ -8,2 +8,2 @@ import { Config } from './type'; | ||
*/ | ||
export declare const version = "1.0.5"; | ||
export declare const version = "1.0.6"; |
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
14702
283