this
doesn't work in strict mode which the SDK is exported as
See https://github.com/vector-im/hydrogen-web/pull/373/files#r927145321
This commit is contained in:
parent
871cf1ad80
commit
c824012968
1 changed files with 4 additions and 5 deletions
|
@ -34,12 +34,11 @@ interface ServiceWorkerHandler {
|
|||
|
||||
async function requestPersistedStorage(): Promise<boolean> {
|
||||
// don't assume browser so we can run in node with fake-idb
|
||||
const glob = this;
|
||||
if (glob?.navigator?.storage?.persist) {
|
||||
return await glob.navigator.storage.persist();
|
||||
} else if (glob?.document.requestStorageAccess) {
|
||||
if (window?.navigator?.storage?.persist) {
|
||||
return await window.navigator.storage.persist();
|
||||
} else if (window?.document.requestStorageAccess) {
|
||||
try {
|
||||
await glob.document.requestStorageAccess();
|
||||
await window.document.requestStorageAccess();
|
||||
return true;
|
||||
} catch (err) {
|
||||
return false;
|
||||
|
|
Reference in a new issue