Skip to content

Commit

Permalink
Extended Usage of isIndexedDBAvailable to Service Worker (#3585)
Browse files Browse the repository at this point in the history
* extended usage of isIndexedDBAvailable to service worker

* Create silly-moles-rush.md

* Update silly-moles-rush.md
  • Loading branch information
XuechunHou authored Aug 10, 2020
1 parent d3f2507 commit d4ca3da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
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": patch
"@firebase/util": patch
---

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

0 comments on commit d4ca3da

Please sign in to comment.