Skip to content

Commit 49a2fa2

Browse files
authored
ref: Expose Ravens constructor publicly. Kinda. (#1272)
1 parent 7fbb94a commit 49a2fa2

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/singleton.js

+36
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,39 @@ Raven.noConflict = function() {
2929
Raven.afterLoad();
3030

3131
module.exports = Raven;
32+
33+
/**
34+
* DISCLAIMER:
35+
*
36+
* Expose `Client` constructor for cases where user want to track multiple "sub-applications" in one larger app.
37+
* It's not meant to be used by a wide audience, so pleaaase make sure that you know what you're doing before using it.
38+
* Accidentally calling `install` multiple times, may result in an unexpected behavior that's very hard to debug.
39+
*
40+
* It's called `Client' to be in-line with Raven Node implementation.
41+
*
42+
* HOWTO:
43+
*
44+
* import Raven from 'raven-js';
45+
*
46+
* const someAppReporter = new Raven.Client();
47+
* const someOtherAppReporter = new Raven.Client();
48+
*
49+
* someAppReporter('__DSN__', {
50+
* ...config goes here
51+
* });
52+
*
53+
* someOtherAppReporter('__OTHER_DSN__', {
54+
* ...config goes here
55+
* });
56+
*
57+
* someAppReporter.captureMessage(...);
58+
* someAppReporter.captureException(...);
59+
* someAppReporter.captureBreadcrumb(...);
60+
*
61+
* someOtherAppReporter.captureMessage(...);
62+
* someOtherAppReporter.captureException(...);
63+
* someOtherAppReporter.captureBreadcrumb(...);
64+
*
65+
* It should "just work".
66+
*/
67+
module.exports.Client = RavenConstructor;

0 commit comments

Comments
 (0)