summaryrefslogtreecommitdiff
path: root/platform/javascript/os_javascript.h
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-01-31 15:28:12 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-02-06 18:53:50 +0100
commit948e66c3d6930924b54ec48a0dfc929040befb0a (patch)
treee188b040ed21bb5eb970a7d15e7cf3f18e037274 /platform/javascript/os_javascript.h
parent3cc72ac03f6d7254220b17e23384196112c60192 (diff)
[HTML5] Implement JavaScript PWA update callbacks.
Allows detecting when a new version of the progressive web app service worker is waiting (i.e. an update is pending), along a function to force the update and reload all clients.
Diffstat (limited to 'platform/javascript/os_javascript.h')
-rw-r--r--platform/javascript/os_javascript.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 3404fe9dcf..9e272f9aa1 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -45,11 +45,13 @@ class OS_JavaScript : public OS_Unix {
bool idb_is_syncing = false;
bool idb_available = false;
bool idb_needs_sync = false;
+ bool pwa_is_waiting = false;
static void main_loop_callback();
static void file_access_close_callback(const String &p_file, int p_flags);
static void fs_sync_callback();
+ static void update_pwa_state_callback();
protected:
void initialize() override;
@@ -65,6 +67,9 @@ public:
// Override return type to make writing static callbacks less tedious.
static OS_JavaScript *get_singleton();
+ bool pwa_needs_update() const { return pwa_is_waiting; }
+ Error pwa_update();
+
void initialize_joypads() override;
MainLoop *get_main_loop() const override;