mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 00:13:30 +00:00
[HTML5] PWA service worker prefers cached version.
Use an offline first approach, where we prefer the cached version over the network one. This forces games using PWA to always re-export the project and not just the PCK, so that the service worker version gets updated correctly, and the end-user cache is correctly cleared on update.
This commit is contained in:
parent
95719930a8
commit
cc4612277b
4 changed files with 112 additions and 63 deletions
|
@ -189,6 +189,9 @@ const Engine = (function () {
|
|||
preloader.preloadedFiles.length = 0; // Clear memory
|
||||
me.rtenv['callMain'](me.config.args);
|
||||
initPromise = null;
|
||||
if (me.config.serviceWorker && 'serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register(me.config.serviceWorker);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue