UNPKG

1.85 kBTypeScriptView Raw
1import type { Event, EventProcessor, Hub, Integration } from '@sentry/types';
2type LocalForage = {
3 setItem<T>(key: string, value: T, callback?: (err: any, value: T) => void): Promise<T>;
4 iterate<T, U>(iteratee: (value: T, key: string, iterationNumber: number) => U, callback?: (err: any, result: U) => void): Promise<U>;
5 removeItem(key: string, callback?: (err: any) => void): Promise<void>;
6 length(): Promise<number>;
7};
8export type Item = {
9 key: string;
10 value: Event;
11};
12/**
13 * cache offline errors and send when connected
14 * @deprecated The offline integration has been deprecated in favor of the offline transport wrapper.
15 *
16 * http://docs.sentry.io/platforms/javascript/configuration/transports/#offline-caching
17 */
18export declare class Offline implements Integration {
19 /**
20 * @inheritDoc
21 */
22 static id: string;
23 /**
24 * @inheritDoc
25 */
26 readonly name: string;
27 /**
28 * the current hub instance
29 */
30 hub?: Hub;
31 /**
32 * maximum number of events to store while offline
33 */
34 maxStoredEvents: number;
35 /**
36 * event cache
37 */
38 offlineEventStore: LocalForage;
39 /**
40 * @inheritDoc
41 */
42 constructor(options?: {
43 maxStoredEvents?: number;
44 });
45 /**
46 * @inheritDoc
47 */
48 setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
49 /**
50 * cache an event to send later
51 * @param event an event
52 */
53 private _cacheEvent;
54 /**
55 * purge excess events if necessary
56 */
57 private _enforceMaxEvents;
58 /**
59 * purge event from cache
60 */
61 private _purgeEvent;
62 /**
63 * purge events from cache
64 */
65 private _purgeEvents;
66 /**
67 * send all events
68 */
69 private _sendEvents;
70}
71export {};
72//# sourceMappingURL=offline.d.ts.map
\No newline at end of file