UNPKG

1.45 kBTypeScriptView Raw
1/**
2 * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,
3 * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.
4 */
5import { Integration } from '@sentry/types';
6/** Internal */
7interface SentryGlobal {
8 Sentry?: {
9 Integrations?: Integration[];
10 };
11 SENTRY_ENVIRONMENT?: string;
12 SENTRY_DSN?: string;
13 SENTRY_RELEASE?: {
14 id?: string;
15 };
16 __SENTRY__: {
17 globalEventProcessors: any;
18 hub: any;
19 logger: any;
20 };
21}
22/**
23 * Safely get global scope object
24 *
25 * @returns Global scope object
26 */
27export declare function getGlobalObject<T>(): T & SentryGlobal;
28/**
29 * Returns a global singleton contained in the global `__SENTRY__` object.
30 *
31 * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory
32 * function and added to the `__SENTRY__` object.
33 *
34 * @param name name of the global singleton on __SENTRY__
35 * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`
36 * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `getGlobalObject`'s return value
37 * @returns the singleton
38 */
39export declare function getGlobalSingleton<T>(name: keyof SentryGlobal['__SENTRY__'], creator: () => T, obj?: unknown): T;
40export {};
41//# sourceMappingURL=global.d.ts.map
\No newline at end of file