1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

[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

@@ -53,5 +53,27 @@
Returns an interface to a JavaScript object that can be used by scripts. The [code]interface[/code] must be a valid property of the JavaScript [code]window[/code]. The callback must accept a single [Array] argument, which will contain the JavaScript [code]arguments[/code]. See [JavaScriptObject] for usage.
</description>
</method>
<method name="pwa_needs_update" qualifiers="const">
<return type="bool" />
<description>
Returns [code]true[/code] if a new version of the progressive web app is waiting to be activated.
[b]Note:[/b] Only relevant when exported as a Progressive Web App.
</description>
</method>
<method name="pwa_update">
<return type="int" enum="Error" />
<description>
Performs the live update of the progressive web app. Forcing the new version to be installed and the page to be reloaded.
[b]Note:[/b] Your application will be [b]reloaded in all browser tabs[/b].
[b]Note:[/b] Only relevant when exported as a Progressive Web App and [method pwa_needs_update] returns [code]true[/code].
</description>
</method>
</methods>
<signals>
<signal name="pwa_update_available">
<description>
Emitted when an update for this progressive web app has been detected but is waiting to be activated because a previous version is active. See [method pwa_update] to force the update to take place immediately.
</description>
</signal>
</signals>
</class>