Having a loop error is a nasty one. Testing your app first in debug mode may prevent such a thing. If Chrome still allows you to open the dev tools, you can:
1. unregister the service worker
2. clear the application cache
A service worker has a build-in system to update its cache if it finds a byte-to-byte difference in the service-worker.js file. Initializing BANano like this with DateTime.Now makes sure it is different with each compilation:
BANano.Initialize("BANano", "Activity",DateTime.Now)
BANano.JAVASCRIPT_NAME = "app" & DateTime.Now & ".js"
Tip: Use the extended UseServiceWorker method so you at least 'see' if it updates:
#if release
BANano.TranspilerOptions.UseServiceWorkerWithUpdateMessage(True, "#26AE60", "Update available", "Click here to update the app to the latest version")
#End If
You could add a switch in your WebApp to force unregister all service workers for this domain and clear the caches:
Snippet:
' Usage: https://domain.com/myApp?reset=true
Dim Reset As String = BANano.GetURLParamDefault(BANano.Location.GetHref, "reset", "")
If Reset <> "" Then
#if javascript
navigator.serviceWorker.getRegistrations().then( function(registrations) {
for(let registration of registrations) {
registration.unregister();
}
});
caches.keys().then(function(cacheNames) {
cacheNames.forEach(function(cacheName) {
caches.delete(cacheName);
});
});
#End If
' if you want, reload the page without the reset switch
BANano.Location.Replace(BANano.Location.GetProtocol & "//" & BANano.location.gethost & BANano.location.getpathname)
Return
end if
Alwaysbusy