Skip to content

Commit 211a6cf

Browse files
committed
extended usage of isIndexedDBAvailable to service worker
1 parent 41ed6f2 commit 211a6cf

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/util/src/environment.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,11 @@ export function isSafari(): boolean {
136136
}
137137

138138
/**
139-
* This method checks if indexedDB is supported by current browser
140-
* @return true if indexedDB is supported by current browser
139+
* This method checks if indexedDB is supported by current browser/service worker context
140+
* @return true if indexedDB is supported by current browser/service worker context
141141
*/
142142
export function isIndexedDBAvailable(): boolean {
143-
if (!('indexedDB' in window) || indexedDB === null) {
144-
return false;
145-
}
146-
return true;
143+
return 'indexedDB' in self && indexedDB !== null;
147144
}
148145

149146
/**

0 commit comments

Comments
 (0)