diff options
| author | George L. Albany <Megacake1234@gmail.com> | 2024-11-26 19:30:58 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-26 19:30:58 +0000 |
| commit | b06d20bf39d15ec736d08d4e4fcb32e0c3c1ce1e (patch) | |
| tree | 79c2a4c34f2d888ff962d76edf474c518d1abdea /misc/dist/html/editor.html | |
| parent | c5b1645e60a59c0292c04bece3fdb0715a61afea (diff) | |
| parent | e58e18261ea7ed3978146ef8d77a900be2601be3 (diff) | |
| download | redot-engine-b06d20bf39d15ec736d08d4e4fcb32e0c3c1ce1e.tar.gz | |
Merge pull request #885 from Spartan322/merge/d09d82d
Merge commit godotengine/godot@d09d82d
Diffstat (limited to 'misc/dist/html/editor.html')
| -rw-r--r-- | misc/dist/html/editor.html | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/misc/dist/html/editor.html b/misc/dist/html/editor.html index ef19c0032e..3fc24e6b76 100644 --- a/misc/dist/html/editor.html +++ b/misc/dist/html/editor.html @@ -363,24 +363,28 @@ window.addEventListener('load', () => { btn.style.display = ''; } if ('serviceWorker' in navigator) { - navigator.serviceWorker.register('service.worker.js').then(function (reg) { - if (reg.waiting) { - notifyUpdate(reg.waiting); - } - reg.addEventListener('updatefound', function () { - const update = reg.installing; - update.addEventListener('statechange', function () { - if (update.state === 'installed') { - // It's a new install, claim and perform aggressive caching. - if (!reg.active) { - update.postMessage('claim'); - } else { - notifyUpdate(update); + try { + navigator.serviceWorker.register('service.worker.js').then(function (reg) { + if (reg.waiting) { + notifyUpdate(reg.waiting); + } + reg.addEventListener('updatefound', function () { + const update = reg.installing; + update.addEventListener('statechange', function () { + if (update.state === 'installed') { + // It's a new install, claim and perform aggressive caching. + if (!reg.active) { + update.postMessage('claim'); + } else { + notifyUpdate(update); + } } - } + }); }); }); - }); + } catch (e) { + console.error('Error while registering service worker:', e); + } } const missing = Engine.getMissingFeatures({ |
