summaryrefslogtreecommitdiffstats
path: root/platform/javascript/os_javascript.h
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-09-18 17:25:05 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2020-09-23 09:51:06 +0200
commitdccd71c7a36fc31f6cc19e0f7f587fb0860c973a (patch)
tree6edeac4fc717836e661dd9a965cf6280693a981b /platform/javascript/os_javascript.h
parent53f04aa1b93d67c62206eb8ee1182ce5f4934123 (diff)
downloadredot-engine-dccd71c7a36fc31f6cc19e0f7f587fb0860c973a.tar.gz
JS synchronous start, better persistent FS sync.
The engine now expects to emscripten FS to be setup and sync-ed before main is called. This is exposed via `Module["initFS"]` which also allows to setup multiple persistence paths (internal use only for now). Additionally, FS syncing is done **once** for every loop if at least one file in a persistent path was open for writing and closed, and if the FS is not syncing already. This should potentially fix issues reported by users where "autosave" would not work on the web (never calling `syncfs` because of too many writes).
Diffstat (limited to 'platform/javascript/os_javascript.h')
-rw-r--r--platform/javascript/os_javascript.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 23809d35a1..85551d708b 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -44,8 +44,7 @@ class OS_JavaScript : public OS_Unix {
bool finalizing = false;
bool idb_available = false;
- int64_t sync_wait_time = -1;
- int64_t last_sync_check_time = -1;
+ bool idb_needs_sync = false;
static void main_loop_callback();
@@ -62,6 +61,8 @@ protected:
bool _check_internal_feature_support(const String &p_feature) override;
public:
+ bool idb_is_syncing = false;
+
// Override return type to make writing static callbacks less tedious.
static OS_JavaScript *get_singleton();