UNPKG

3.13 kBTypeScriptView Raw
1import { Integrations as CoreIntegrations } from '@sentry/core';
2import { BrowserOptions } from './backend';
3import { ReportDialogOptions } from './helpers';
4import { Breadcrumbs, GlobalHandlers, LinkedErrors, TryCatch, UserAgent } from './integrations';
5export declare const defaultIntegrations: (CoreIntegrations.FunctionToString | CoreIntegrations.InboundFilters | GlobalHandlers | TryCatch | Breadcrumbs | LinkedErrors | UserAgent)[];
6/**
7 * The Sentry Browser SDK Client.
8 *
9 * To use this SDK, call the {@link init} function as early as possible when
10 * loading the web page. To set context information or send manual events, use
11 * the provided methods.
12 *
13 * @example
14 *
15 * ```
16 *
17 * import { init } from '@sentry/browser';
18 *
19 * init({
20 * dsn: '__DSN__',
21 * // ...
22 * });
23 * ```
24 *
25 * @example
26 * ```
27 *
28 * import { configureScope } from '@sentry/browser';
29 * configureScope((scope: Scope) => {
30 * scope.setExtra({ battery: 0.7 });
31 * scope.setTag({ user_mode: 'admin' });
32 * scope.setUser({ id: '4711' });
33 * });
34 * ```
35 *
36 * @example
37 * ```
38 *
39 * import { addBreadcrumb } from '@sentry/browser';
40 * addBreadcrumb({
41 * message: 'My Breadcrumb',
42 * // ...
43 * });
44 * ```
45 *
46 * @example
47 *
48 * ```
49 *
50 * import * as Sentry from '@sentry/browser';
51 * Sentry.captureMessage('Hello, world!');
52 * Sentry.captureException(new Error('Good bye'));
53 * Sentry.captureEvent({
54 * message: 'Manual',
55 * stacktrace: [
56 * // ...
57 * ],
58 * });
59 * ```
60 *
61 * @see {@link BrowserOptions} for documentation on configuration options.
62 */
63export declare function init(options?: BrowserOptions): void;
64/**
65 * Present the user with a report dialog.
66 *
67 * @param options Everything is optional, we try to fetch all info need from the global scope.
68 */
69export declare function showReportDialog(options?: ReportDialogOptions): void;
70/**
71 * This is the getter for lastEventId.
72 *
73 * @returns The last event id of a captured event.
74 */
75export declare function lastEventId(): string | undefined;
76/**
77 * This function is here to be API compatible with the loader.
78 * @hidden
79 */
80export declare function forceLoad(): void;
81/**
82 * This function is here to be API compatible with the loader.
83 * @hidden
84 */
85export declare function onLoad(callback: () => void): void;
86/**
87 * A promise that resolves when all current events have been sent.
88 * If you provide a timeout and the queue takes longer to drain the promise returns false.
89 *
90 * @param timeout Maximum time in ms the client should wait.
91 */
92export declare function flush(timeout?: number): PromiseLike<boolean>;
93/**
94 * A promise that resolves when all current events have been sent.
95 * If you provide a timeout and the queue takes longer to drain the promise returns false.
96 *
97 * @param timeout Maximum time in ms the client should wait.
98 */
99export declare function close(timeout?: number): PromiseLike<boolean>;
100/**
101 * Wrap code within a try/catch block so the SDK is able to capture errors.
102 *
103 * @param fn A function to wrap.
104 *
105 * @returns The result of wrapped function call.
106 */
107export declare function wrap(fn: (...args: any) => any): any;
108//# sourceMappingURL=sdk.d.ts.map
\No newline at end of file