Skip to content

Extended Usage of isIndexedDBAvailable to Service Worker #3585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/silly-moles-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@firebase/firebase": minor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't catch this in the previous PR but the package name is firebase, there's no @firebase/firebase. Also I think these should be patch because there's no API change.

"@firebase/util": minor
---

Extended Usage of `isIndexedDBAvailable` to Service Worker
9 changes: 3 additions & 6 deletions packages/util/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,11 @@ export function isSafari(): boolean {
}

/**
* This method checks if indexedDB is supported by current browser
* @return true if indexedDB is supported by current browser
* This method checks if indexedDB is supported by current browser/service worker context
* @return true if indexedDB is supported by current browser/service worker context
*/
export function isIndexedDBAvailable(): boolean {
if (!('indexedDB' in window) || indexedDB === null) {
return false;
}
return true;
return 'indexedDB' in self && indexedDB !== null;
}

/**
Expand Down