fall back to non-standard persisted api for Safari
This commit is contained in:
parent
26bda5933b
commit
f6e9c32c48
2 changed files with 11 additions and 0 deletions
|
@ -119,6 +119,12 @@ export default async function sendBugReport(bugReportEndpoint, opts) {
|
||||||
body.append("storageManager_persisted", await navigator.storage.persisted());
|
body.append("storageManager_persisted", await navigator.storage.persisted());
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}
|
}
|
||||||
|
// Safari
|
||||||
|
if (document.hasStorageAccess) {
|
||||||
|
try {
|
||||||
|
body.append("storageManager_persisted", await document.hasStorageAccess());
|
||||||
|
} catch (e) {}
|
||||||
|
}
|
||||||
if (navigator.storage && navigator.storage.estimate) {
|
if (navigator.storage && navigator.storage.estimate) {
|
||||||
try {
|
try {
|
||||||
const estimate = await navigator.storage.estimate();
|
const estimate = await navigator.storage.estimate();
|
||||||
|
|
|
@ -48,6 +48,11 @@ export function tryPersistStorage() {
|
||||||
navigator.storage.persist().then(persistent => {
|
navigator.storage.persist().then(persistent => {
|
||||||
console.log("StorageManager: Persistent?", persistent);
|
console.log("StorageManager: Persistent?", persistent);
|
||||||
});
|
});
|
||||||
|
} else if (document.requestStorageAccess) { //Safari
|
||||||
|
document.requestStorageAccess().then(
|
||||||
|
() => console.log("StorageManager: Persistent?", true),
|
||||||
|
() => console.log("StorageManager: Persistent?", false),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
console.log("StorageManager: Persistence unsupported");
|
console.log("StorageManager: Persistence unsupported");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue