Created
December 1, 2022 19:23
-
-
Save hwclass/ab58dd7799d25287b74611290839fcff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// if user accepts, this will give `persistent` (true/false, 1/0) back to the promise itself | |
if (navigator.storage && navigator.storage.persist) { | |
navigator.storage.persist().then((persistent) => { | |
if (persistent) { | |
// let the user know about what will happen | |
"Great! You will never loose your data even after clearing the cache of your browser." | |
} else { | |
"Ups, you need to activate storage within your browser to get notified." | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment