@sentry/hub
Advanced tools
Comparing version 4.0.1 to 4.0.5
@@ -6,2 +6,8 @@ import { Hub } from './hub'; | ||
/** | ||
* Replaces the current main hub with the passed one on the global object | ||
* | ||
* @returns The old replaced hub | ||
*/ | ||
export declare function makeMain(hub?: Hub): Hub | undefined; | ||
/** | ||
* Returns the default hub instance. | ||
@@ -8,0 +14,0 @@ * |
@@ -15,2 +15,14 @@ "use strict"; | ||
/** | ||
* Replaces the current main hub with the passed one on the global object | ||
* | ||
* @returns The old replaced hub | ||
*/ | ||
function makeMain(hub) { | ||
var registry = getMainCarrier(); | ||
var oldHub = registry.hub; | ||
registry.hub = hub; | ||
return oldHub; | ||
} | ||
exports.makeMain = makeMain; | ||
/** | ||
* Returns the default hub instance. | ||
@@ -17,0 +29,0 @@ * |
@@ -144,2 +144,8 @@ import { Breadcrumb, SentryBreadcrumbHint, SentryEvent, SentryEventHint, Severity } from '@sentry/types'; | ||
configureScope(callback: (scope: Scope) => void): void; | ||
/** | ||
* For the duraction of the callback, this hub will be set as the global current Hub. | ||
* This function is useful if you want to run your own client and hook into an already initialized one | ||
* e.g.: Reporting issues to your own sentry when running in your component while still using the users configuration | ||
*/ | ||
run(callback: ((hub: Hub) => void)): void; | ||
} |
@@ -35,2 +35,3 @@ "use strict"; | ||
var misc_1 = require("@sentry/utils/misc"); | ||
var global_1 = require("./global"); | ||
var scope_1 = require("./scope"); | ||
@@ -268,2 +269,16 @@ /** | ||
}; | ||
/** | ||
* For the duraction of the callback, this hub will be set as the global current Hub. | ||
* This function is useful if you want to run your own client and hook into an already initialized one | ||
* e.g.: Reporting issues to your own sentry when running in your component while still using the users configuration | ||
*/ | ||
Hub.prototype.run = function (callback) { | ||
var oldHub = global_1.makeMain(this); | ||
try { | ||
callback(this); | ||
} | ||
finally { | ||
global_1.makeMain(oldHub); | ||
} | ||
}; | ||
return Hub; | ||
@@ -270,0 +285,0 @@ }()); |
{ | ||
"name": "@sentry/hub", | ||
"version": "4.0.1", | ||
"version": "4.0.5", | ||
"description": "Sentry hub which handles global state managment.", | ||
@@ -18,4 +18,4 @@ "repository": "git://github.com/getsentry/raven-js.git", | ||
"dependencies": { | ||
"@sentry/types": "4.0.0", | ||
"@sentry/utils": "4.0.1" | ||
"@sentry/types": "4.0.1", | ||
"@sentry/utils": "4.0.5" | ||
}, | ||
@@ -22,0 +22,0 @@ "devDependencies": { |
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
67989
962
+ Added@sentry/types@4.0.1(transitive)
+ Added@sentry/utils@4.0.5(transitive)
- Removed@sentry/types@4.0.0(transitive)
- Removed@sentry/utils@4.0.1(transitive)
Updated@sentry/types@4.0.1
Updated@sentry/utils@4.0.5