Use Persistent Storage where possible

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-02-20 00:38:08 +00:00
parent 12eb408c58
commit ffde11ca91
3 changed files with 32 additions and 0 deletions

View file

@ -43,6 +43,16 @@ function track(action) {
Analytics.trackEvent("StorageManager", action);
}
export function tryPersistStorage() {
if (navigator.storage && navigator.storage.persist) {
navigator.storage.persist().then(persistent => {
console.log("StorageManager: Persistent?", persistent);
});
} else {
console.log("StorageManager: Persistence unsupported");
}
}
export async function checkConsistency() {
log("Checking storage consistency");
log(`Local storage supported? ${!!localStorage}`);