From 524ec334e705733dbba0f107662479484e8651e3 Mon Sep 17 00:00:00 2001 From: Piotr Konieczny Date: Thu, 10 Sep 2020 11:05:57 +0200 Subject: [PATCH] Move event listeners setup from constructor to setupOnce --- packages/integrations/src/offline.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/integrations/src/offline.ts b/packages/integrations/src/offline.ts index f4f60b7546cf..85b561b950e1 100644 --- a/packages/integrations/src/offline.ts +++ b/packages/integrations/src/offline.ts @@ -51,6 +51,13 @@ export class Offline implements Integration { this.offlineEventStore = localForage.createInstance({ name: 'sentry/offlineEventStore', }); + } + + /** + * @inheritDoc + */ + public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void { + this.hub = getCurrentHub(); if ('addEventListener' in this.global) { this.global.addEventListener('online', () => { @@ -59,13 +66,6 @@ export class Offline implements Integration { }); }); } - } - - /** - * @inheritDoc - */ - public setupOnce(addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void { - this.hub = getCurrentHub(); addGlobalEventProcessor((event: Event) => { if (this.hub && this.hub.getIntegration(Offline)) {