From 948e66c3d6930924b54ec48a0dfc929040befb0a Mon Sep 17 00:00:00 2001 From: Fabio Alessandrelli Date: Mon, 31 Jan 2022 15:28:12 +0100 Subject: [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. --- platform/javascript/os_javascript.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'platform/javascript/os_javascript.h') 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; -- cgit v1.2.3