Skip to content

Commit

Permalink
fix(integrations): Add localforage type (#2861)
Browse files Browse the repository at this point in the history
  • Loading branch information
AbhiPrasad authored Aug 28, 2020
1 parent beb727d commit ec35290
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/integrations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@sentry/types": "5.22.1",
"@sentry/utils": "5.22.1",
"localforage": "^1.8.1",
"localforage": "1.8.1",
"tslib": "^1.9.3"
},
"devDependencies": {
Expand Down
7 changes: 5 additions & 2 deletions packages/integrations/src/offline.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Event, EventProcessor, Hub, Integration } from '@sentry/types';
import { getGlobalObject, logger, uuid4 } from '@sentry/utils';
import * as localForage from 'localforage';
import * as localForageType from 'localforage';

// eslint-disable-next-line @typescript-eslint/no-var-requires
const localForage = require('localforage');
/**
* cache offline errors and send when connected
*/
Expand Down Expand Up @@ -34,14 +36,15 @@ export class Offline implements Integration {
/**
* event cache
*/
public offlineEventStore: LocalForage; // type imported from localforage
public offlineEventStore: typeof localForageType; // type imported from localforage

/**
* @inheritDoc
*/
public constructor(options: { maxStoredEvents?: number } = {}) {
this.global = getGlobalObject<Window>();
this.maxStoredEvents = options.maxStoredEvents || 30; // set a reasonable default
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
this.offlineEventStore = localForage.createInstance({
name: 'sentry/offlineEventStore',
});
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12386,10 +12386,10 @@ loader.js@^4.7.0:
resolved "https://registry.yarnpkg.com/loader.js/-/loader.js-4.7.0.tgz#a1a52902001c83631efde9688b8ab3799325ef1f"
integrity sha512-9M2KvGT6duzGMgkOcTkWb+PR/Q2Oe54df/tLgHGVmFpAmtqJ553xJh6N63iFYI2yjo2PeJXbS5skHi/QpJq4vA==

localforage@^1.8.1:
version "1.9.0"
resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.9.0.tgz#f3e4d32a8300b362b4634cc4e066d9d00d2f09d1"
integrity sha512-rR1oyNrKulpe+VM9cYmcFn6tsHuokyVHFaCM3+osEmxaHTbEk8oQu6eGDfS6DQLWi/N67XRmB8ECG37OES368g==
[email protected]:
version "1.8.1"
resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.8.1.tgz#f6c0a24b41ab33b10e4dc84342dd696f6f3e3433"
integrity sha512-azSSJJfc7h4bVpi0PGi+SmLQKJl2/8NErI+LhJsrORNikMZnhaQ7rv9fHj+ofwgSHrKRlsDCL/639a6nECIKuQ==
dependencies:
lie "3.1.1"

Expand Down

0 comments on commit ec35290

Please sign in to comment.