Skip to content

Commit f9829dd

Browse files
authored
Update utils.js
1 parent 0bbeff1 commit f9829dd

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

utils.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,19 +191,25 @@ window.addEventListener('offline', () => { isOffline = true });
191191

192192
let isPersistStorage = false;
193193

194-
if (navigator.storage && navigator.storage.persist) {
194+
async function checkPersistStorage() {
195195

196-
isPersistStorage = await navigator.storage.persisted();
197-
198-
if (!isPersistStorage) {
199-
200-
// request persistent storage
201-
isPersistStorage = await navigator.storage.persist();
202-
196+
if (navigator.storage && navigator.storage.persist) {
197+
198+
isPersistStorage = await navigator.storage.persisted();
199+
200+
if (!isPersistStorage) {
201+
202+
// request persistent storage
203+
isPersistStorage = await navigator.storage.persist();
204+
205+
}
206+
203207
}
204208

205209
}
206210

211+
checkPersistStorage();
212+
207213

208214
// base64 encode/decode
209215

0 commit comments

Comments
 (0)