forked from tools/josh
1
0
Fork 0

Avoid unnecessary /nav API call

This commit is contained in:
Florine W. Dekker 2021-03-31 17:31:42 +02:00
parent 71ba3686f9
commit e152eb2ad4
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
3 changed files with 12 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "fwdekker.com", "name": "fwdekker.com",
"version": "0.39.16", "version": "0.39.17",
"description": "The source code of [my personal website](https://fwdekker.com/).", "description": "The source code of [my personal website](https://fwdekker.com/).",
"author": "Felix W. Dekker", "author": "Felix W. Dekker",
"browser": "dist/bundle.js", "browser": "dist/bundle.js",

View File

@ -60,6 +60,7 @@ addOnLoad(() => {
* Initializes the application. * Initializes the application.
*/ */
addOnLoad(async () => { addOnLoad(async () => {
if (!Persistence.hasFileSystem())
await FileSystem.loadNavApi(); await FileSystem.loadNavApi();
window.terminal = new Terminal( window.terminal = new Terminal(

View File

@ -26,6 +26,15 @@ export class Persistence {
/// Long-term storage /// Long-term storage
/// ///
/**
* Returns true if and only if a file system is stored in the persistent storage.
*
* @return true if and only if a file system is stored in the persistent storage
*/
static hasFileSystem(): boolean {
return localStorage.getItem("//files") !== null;
}
/** /**
* Deserializes a file system from persistent storage, or returns the default file system if the deserialization * Deserializes a file system from persistent storage, or returns the default file system if the deserialization
* failed. * failed.