[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.
This commit is contained in:
Fabio Alessandrelli 2022-01-31 15:28:12 +01:00
parent 3cc72ac03f
commit 948e66c3d6
8 changed files with 119 additions and 0 deletions

View file

@ -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;