From d1876f72fa2563373787e5ba600a4c87c4700bc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jens=20M=C3=B6nig?= Date: Wed, 9 Oct 2024 14:25:06 +0200 Subject: [PATCH] reenabled pwa service worker because the Chrome v129 memory issue seems to have been fixed by Google --- HISTORY.md | 1 + snap.html | 24 +++++++++++------------- sw_deactivated.js => sw.js | 6 +----- 3 files changed, 13 insertions(+), 18 deletions(-) rename sw_deactivated.js => sw.js (99%) diff --git a/HISTORY.md b/HISTORY.md index 0dc062453..31537a9bd 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -4,6 +4,7 @@ * **New Features:** * added extensions to access the "Thread safe scripts" setting * **Notable Changes:** + * reenabled pwa service worker because the Chrome v129 memory issue seems to have been fixed by Google * changed polling scheduler for streaming data from serial ports to be in lock step with Morphic * updated Microblocks library to improve event streaming fluency * **Notable Fixes:** diff --git a/snap.html b/snap.html index ffd18a1e9..df784056b 100755 --- a/snap.html +++ b/snap.html @@ -43,23 +43,21 @@ var FPS = 67, lastTime = 0, - loop = (timestamp) => { - requestAnimationFrame(loop); - if (timestamp - lastTime < 1000 / FPS) { - return; - } - world.doOneCycle(); - lastTime = Math.max( - lastTime + 1000 / FPS, - timestamp - 1000 / FPS - ); - }; + loop = (timestamp) => { + requestAnimationFrame(loop); + if (timestamp - lastTime < 1000 / FPS) { + return; + } + world.doOneCycle(); + lastTime = Math.max( + lastTime + 1000 / FPS, + timestamp - 1000 / FPS + ); + }; -/* if ('serviceWorker' in navigator) { navigator.serviceWorker.register('sw.js'); } -*/ world = new WorldMorph(document.getElementById('world')); new IDE_Morph().openIn(world); requestAnimationFrame(loop); diff --git a/sw_deactivated.js b/sw.js similarity index 99% rename from sw_deactivated.js rename to sw.js index 7e18b9ef9..b4635a82b 100644 --- a/sw_deactivated.js +++ b/sw.js @@ -1,8 +1,4 @@ -/* - the PWA service worker is currently not used because of a memory leak - issue introduced in Chrome v129 -*/ -var snapVersion = '10.0.11', // currently unused +var snapVersion = '10.0.11', cacheName = `snap-pwa-${snapVersion}`, filesToCache = [ 'snap.html',