Sentry-javascript: .uninstall method for @sentry/browser

Created on 18 Jan 2019  路  4Comments  路  Source: getsentry/sentry-javascript

Package + Version

  • [x] @sentry/browser

Version:

4.5.2

Description

Whats is analogue of Raven.uninstall while using @sentry/browser? Sentry.uninstall is not available.

Feature Question

Most helpful comment

@HazAT Our use case for this is when a developer wants to play around in the JS console to debug something, or try and get some function working. In this case, it would be great to be able to "unload" or "uninit" Sentry to stop it sending errors.
Is there some easy snippit that we can use to uninit it without a page load?

All 4 comments

Hey, indeed we did not implement this function yet.
It's not an often requested feature, can you elaborate the use-case why you would need a uninstall function?
The reason being not adding an uninstall function is that we actually do not have an install function anymore, there is only init. And we thought that if people for whatever reason want to uninstall the SDK they should do a page reload and not call init anymore.

I am closing this for now since we do not plan to add this unless we have a very good reason for it.

@HazAT Our use case for this is when a developer wants to play around in the JS console to debug something, or try and get some function working. In this case, it would be great to be able to "unload" or "uninit" Sentry to stop it sending errors.
Is there some easy snippit that we can use to uninit it without a page load?

Is there some easy snippit that we can use to uninit it without a page load?

It won't restore wrapped native functions, but to disable sending you can use:

Sentry.getCurrentHub().getClient().getOptions().enabled = false

(it's not public API, so I cannot promise it will always work, but if you want to use it for development only then it's fine)

Was this page helpful?
0 / 5 - 0 ratings