mirror of
https://github.com/aljazceru/mutiny-web.git
synced 2025-12-17 06:14:21 +01:00
Move persistent storage init
This commit is contained in:
committed by
Paul Miller
parent
318fa6f353
commit
bc38a873fb
@@ -208,6 +208,26 @@ export const makeMegaStoreContext = () => {
|
||||
console.log("No nsec stored");
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Storage_API
|
||||
// Ask the browser to not clear storage
|
||||
if (navigator.storage && navigator.storage.persist) {
|
||||
navigator.storage.persist().then((persistent) => {
|
||||
if (persistent) {
|
||||
console.log(
|
||||
"Storage will not be cleared except by explicit user action"
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
"Storage may be cleared by the UA under storage pressure."
|
||||
);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
console.warn(
|
||||
"Persistent storage not supported, storage may be cleared by the UA under storage pressure."
|
||||
);
|
||||
}
|
||||
|
||||
const success = await sw.setupMutinyWallet(
|
||||
settings,
|
||||
password,
|
||||
|
||||
@@ -97,22 +97,6 @@ export async function setupMutinyWallet(
|
||||
): Promise<boolean> {
|
||||
console.log("Starting setup...");
|
||||
|
||||
// https://developer.mozilla.org/en-US/docs/Web/API/Storage_API
|
||||
// Ask the browser to not clear storage
|
||||
if (navigator.storage && navigator.storage.persist) {
|
||||
navigator.storage.persist().then((persistent) => {
|
||||
if (persistent) {
|
||||
console.log(
|
||||
"Storage will not be cleared except by explicit user action"
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
"Storage may be cleared by the UA under storage pressure."
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const {
|
||||
network,
|
||||
proxy,
|
||||
|
||||
Reference in New Issue
Block a user