mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
Merge pull request #97645 from adamscott/fix-pwa-reloading-page
Fix web export infinite reload issue
This commit is contained in:
commit
6388314dcc
7
misc/dist/html/full-size.html
vendored
7
misc/dist/html/full-size.html
vendored
@ -164,10 +164,11 @@ const engine = new Engine(GODOT_CONFIG);
|
|||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
setTimeout(() => resolve(), 2000);
|
setTimeout(() => resolve(), 2000);
|
||||||
}),
|
}),
|
||||||
]).catch((err) => {
|
]).then(() => {
|
||||||
console.error('Error while registering service worker:', err);
|
// Reload if there was no error.
|
||||||
}).then(() => {
|
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error('Error while registering service worker:', err);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Display the message as usual
|
// Display the message as usual
|
||||||
|
@ -214,6 +214,9 @@ Error EditorExportPlatformWeb::_add_manifest_icon(const String &p_path, const St
|
|||||||
}
|
}
|
||||||
|
|
||||||
Error EditorExportPlatformWeb::_build_pwa(const Ref<EditorExportPreset> &p_preset, const String p_path, const Vector<SharedObject> &p_shared_objects) {
|
Error EditorExportPlatformWeb::_build_pwa(const Ref<EditorExportPreset> &p_preset, const String p_path, const Vector<SharedObject> &p_shared_objects) {
|
||||||
|
List<String> preset_features;
|
||||||
|
get_preset_features(p_preset, &preset_features);
|
||||||
|
|
||||||
String proj_name = GLOBAL_GET("application/config/name");
|
String proj_name = GLOBAL_GET("application/config/name");
|
||||||
if (proj_name.is_empty()) {
|
if (proj_name.is_empty()) {
|
||||||
proj_name = "Godot Game";
|
proj_name = "Godot Game";
|
||||||
@ -239,7 +242,10 @@ Error EditorExportPlatformWeb::_build_pwa(const Ref<EditorExportPreset> &p_prese
|
|||||||
cache_files.push_back(name + ".icon.png");
|
cache_files.push_back(name + ".icon.png");
|
||||||
cache_files.push_back(name + ".apple-touch-icon.png");
|
cache_files.push_back(name + ".apple-touch-icon.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (preset_features.find("threads")) {
|
||||||
cache_files.push_back(name + ".worker.js");
|
cache_files.push_back(name + ".worker.js");
|
||||||
|
}
|
||||||
cache_files.push_back(name + ".audio.worklet.js");
|
cache_files.push_back(name + ".audio.worklet.js");
|
||||||
cache_files.push_back(name + ".audio.position.worklet.js");
|
cache_files.push_back(name + ".audio.position.worklet.js");
|
||||||
replaces["___GODOT_CACHE___"] = Variant(cache_files).to_json_string();
|
replaces["___GODOT_CACHE___"] = Variant(cache_files).to_json_string();
|
||||||
|
Loading…
Reference in New Issue
Block a user