1 | import { Event, EventProcessor, Hub, Integration } from '@sentry/types';
|
2 | declare type 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 | };
|
8 | export declare type Item = {
|
9 | key: string;
|
10 | value: Event;
|
11 | };
|
12 | /**
|
13 | * cache offline errors and send when connected
|
14 | */
|
15 | export declare class Offline implements Integration {
|
16 | /**
|
17 | * @inheritDoc
|
18 | */
|
19 | static id: string;
|
20 | /**
|
21 | * @inheritDoc
|
22 | */
|
23 | readonly name: string;
|
24 | /**
|
25 | * the global instance
|
26 | */
|
27 | global: any;
|
28 | /**
|
29 | * the current hub instance
|
30 | */
|
31 | hub?: Hub;
|
32 | /**
|
33 | * maximum number of events to store while offline
|
34 | */
|
35 | maxStoredEvents: number;
|
36 | /**
|
37 | * event cache
|
38 | */
|
39 | offlineEventStore: LocalForage;
|
40 | /**
|
41 | * @inheritDoc
|
42 | */
|
43 | constructor(options?: {
|
44 | maxStoredEvents?: number;
|
45 | });
|
46 | /**
|
47 | * @inheritDoc
|
48 | */
|
49 | setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void;
|
50 | /**
|
51 | * cache an event to send later
|
52 | * @param event an event
|
53 | */
|
54 | private _cacheEvent;
|
55 | /**
|
56 | * purge excess events if necessary
|
57 | */
|
58 | private _enforceMaxEvents;
|
59 | /**
|
60 | * purge event from cache
|
61 | */
|
62 | private _purgeEvent;
|
63 | /**
|
64 | * purge events from cache
|
65 | */
|
66 | private _purgeEvents;
|
67 | /**
|
68 | * send all events
|
69 | */
|
70 | private _sendEvents;
|
71 | }
|
72 | export {};
|
73 | //# sourceMappingURL=offline.d.ts.map |
\ | No newline at end of file |