UNPKG

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