Skip to content

Commit b7bbf35

Browse files
authored
ref(offline integration): Move event listener setup from constructor to setupOnce (#2889)
1 parent 48ad138 commit b7bbf35

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

packages/integrations/src/offline.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ export class Offline implements Integration {
5151
this.offlineEventStore = localForage.createInstance({
5252
name: 'sentry/offlineEventStore',
5353
});
54+
}
55+
56+
/**
57+
* @inheritDoc
58+
*/
59+
public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {
60+
this.hub = getCurrentHub();
5461

5562
if ('addEventListener' in this.global) {
5663
this.global.addEventListener('online', () => {
@@ -59,13 +66,6 @@ export class Offline implements Integration {
5966
});
6067
});
6168
}
62-
}
63-
64-
/**
65-
* @inheritDoc
66-
*/
67-
public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {
68-
this.hub = getCurrentHub();
6969

7070
addGlobalEventProcessor((event: Event) => {
7171
if (this.hub && this.hub.getIntegration(Offline)) {

0 commit comments

Comments
 (0)