@sentry/browser
Advanced tools
Comparing version
@@ -49,2 +49,3 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); | ||
setTimeout: true, | ||
unregisterOriginalCallbacks: false, | ||
...options, | ||
@@ -77,3 +78,3 @@ }; | ||
const eventTarget = Array.isArray(eventTargetOption) ? eventTargetOption : DEFAULT_EVENT_TARGET; | ||
eventTarget.forEach(_wrapEventTarget); | ||
eventTarget.forEach(target => _wrapEventTarget(target, _options)); | ||
} | ||
@@ -156,3 +157,3 @@ }, | ||
function _wrapEventTarget(target) { | ||
function _wrapEventTarget(target, integrationOptions) { | ||
const globalObject = helpers.WINDOW ; | ||
@@ -194,2 +195,6 @@ const proto = globalObject[target]?.prototype; | ||
if (integrationOptions.unregisterOriginalCallbacks) { | ||
unregisterOriginalCallback(this, eventName, fn); | ||
} | ||
return original.apply(this, [ | ||
@@ -251,3 +256,14 @@ eventName, | ||
function unregisterOriginalCallback(target, eventName, fn) { | ||
if ( | ||
target && | ||
typeof target === 'object' && | ||
'removeEventListener' in target && | ||
typeof target.removeEventListener === 'function' | ||
) { | ||
target.removeEventListener(eventName, fn); | ||
} | ||
} | ||
exports.browserApiErrorsIntegration = browserApiErrorsIntegration; | ||
//# sourceMappingURL=browserapierrors.js.map |
@@ -47,2 +47,3 @@ import { defineIntegration, fill, getFunctionName, getOriginalFunction } from '@sentry/core'; | ||
setTimeout: true, | ||
unregisterOriginalCallbacks: false, | ||
...options, | ||
@@ -75,3 +76,3 @@ }; | ||
const eventTarget = Array.isArray(eventTargetOption) ? eventTargetOption : DEFAULT_EVENT_TARGET; | ||
eventTarget.forEach(_wrapEventTarget); | ||
eventTarget.forEach(target => _wrapEventTarget(target, _options)); | ||
} | ||
@@ -154,3 +155,3 @@ }, | ||
function _wrapEventTarget(target) { | ||
function _wrapEventTarget(target, integrationOptions) { | ||
const globalObject = WINDOW ; | ||
@@ -192,2 +193,6 @@ const proto = globalObject[target]?.prototype; | ||
if (integrationOptions.unregisterOriginalCallbacks) { | ||
unregisterOriginalCallback(this, eventName, fn); | ||
} | ||
return original.apply(this, [ | ||
@@ -249,3 +254,14 @@ eventName, | ||
function unregisterOriginalCallback(target, eventName, fn) { | ||
if ( | ||
target && | ||
typeof target === 'object' && | ||
'removeEventListener' in target && | ||
typeof target.removeEventListener === 'function' | ||
) { | ||
target.removeEventListener(eventName, fn); | ||
} | ||
} | ||
export { browserApiErrorsIntegration }; | ||
//# sourceMappingURL=browserapierrors.js.map |
@@ -1,1 +0,1 @@ | ||
{"type":"module","version":"9.23.0","sideEffects":false} | ||
{"type":"module","version":"9.24.0","sideEffects":false} |
@@ -7,2 +7,10 @@ interface BrowserApiErrorsOptions { | ||
eventTarget: boolean | string[]; | ||
/** | ||
* If you experience issues with this integration causing double-invocations of event listeners, | ||
* try setting this option to `true`. It will unregister the original callbacks from the event targets | ||
* before adding the instrumented callback. | ||
* | ||
* @default false | ||
*/ | ||
unregisterOriginalCallbacks: boolean; | ||
} | ||
@@ -9,0 +17,0 @@ /** |
@@ -7,2 +7,10 @@ interface BrowserApiErrorsOptions { | ||
eventTarget: boolean | string[]; | ||
/** | ||
* If you experience issues with this integration causing double-invocations of event listeners, | ||
* try setting this option to `true`. It will unregister the original callbacks from the event targets | ||
* before adding the instrumented callback. | ||
* | ||
* @default false | ||
*/ | ||
unregisterOriginalCallbacks: boolean; | ||
} | ||
@@ -9,0 +17,0 @@ /** |
{ | ||
"name": "@sentry/browser", | ||
"version": "9.23.0", | ||
"version": "9.24.0", | ||
"description": "Official Sentry SDK for browsers", | ||
@@ -42,10 +42,10 @@ "repository": "git://github.com/getsentry/sentry-javascript.git", | ||
"dependencies": { | ||
"@sentry-internal/browser-utils": "9.23.0", | ||
"@sentry-internal/feedback": "9.23.0", | ||
"@sentry-internal/replay": "9.23.0", | ||
"@sentry-internal/replay-canvas": "9.23.0", | ||
"@sentry/core": "9.23.0" | ||
"@sentry-internal/browser-utils": "9.24.0", | ||
"@sentry-internal/feedback": "9.24.0", | ||
"@sentry-internal/replay": "9.24.0", | ||
"@sentry-internal/replay-canvas": "9.24.0", | ||
"@sentry/core": "9.24.0" | ||
}, | ||
"devDependencies": { | ||
"@sentry-internal/integration-shims": "9.23.0", | ||
"@sentry-internal/integration-shims": "9.24.0", | ||
"fake-indexeddb": "^4.0.1" | ||
@@ -52,0 +52,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1220809
0.36%13233
0.33%+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
Updated