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 | *
|
5 | * Note: This file was originally called `global.ts`, but was changed to unblock users which might be doing
|
6 | * string replaces with bundlers like Vite for `global` (would break imports that rely on importing from utils/src/global).
|
7 | *
|
8 | * Why worldwide?
|
9 | *
|
10 | * Why not?
|
11 | */
|
12 | import { Integration } from '@sentry/types';
|
13 | /** Internal global with common properties and Sentry extensions */
|
14 | export interface InternalGlobal {
|
15 | navigator?: {
|
16 | userAgent?: string;
|
17 | };
|
18 | console: Console;
|
19 | Sentry?: {
|
20 | Integrations?: Integration[];
|
21 | };
|
22 | SENTRY_ENVIRONMENT?: string;
|
23 | SENTRY_DSN?: string;
|
24 | SENTRY_RELEASE?: {
|
25 | id?: string;
|
26 | };
|
27 | __SENTRY__: {
|
28 | globalEventProcessors: any;
|
29 | hub: any;
|
30 | logger: any;
|
31 | extensions?: {
|
32 | /** Extension methods for the hub, which are bound to the current Hub instance */
|
33 | [key: string]: Function;
|
34 | };
|
35 | };
|
36 | }
|
37 | /** Get's the global object for the current JavaScript runtime */
|
38 | export declare const GLOBAL_OBJ: InternalGlobal;
|
39 | /**
|
40 | * @deprecated Use GLOBAL_OBJ instead or WINDOW from @sentry/browser. This will be removed in v8
|
41 | */
|
42 | export declare function getGlobalObject<T>(): T & InternalGlobal;
|
43 | /**
|
44 | * Returns a global singleton contained in the global `__SENTRY__` object.
|
45 | *
|
46 | * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory
|
47 | * function and added to the `__SENTRY__` object.
|
48 | *
|
49 | * @param name name of the global singleton on __SENTRY__
|
50 | * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`
|
51 | * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value
|
52 | * @returns the singleton
|
53 | */
|
54 | export declare function getGlobalSingleton<T>(name: keyof InternalGlobal['__SENTRY__'], creator: () => T, obj?: unknown): T;
|
55 | //# sourceMappingURL=worldwide.d.ts.map |
\ | No newline at end of file |