TalAter/UpUp

All pages on a domain are loaded through UpUp after upup usage

ovidiugabriel opened this issue · 6 comments

Hi,

I used a simple test page to test how UpUp is working. I would like to adopt it into a new project.
After I used it, all the requests to my domain are strongly cached and sometimes I can see that offline content on the test page even if the URL in the browser has nothing to do with the UpUp test page.

How do I unregister/stop the service worker?

I assume that I have to call ServiceWorkerRegistration.unregister()

I tried the following code:

pro = navigator.serviceWorker.getRegistrations()
pro.then(function(registrations) {
    for(registration of registrations) {
        registration.unregister()
    }
})

but I received Uncaught (in promise) TypeError: registration.unregister is not a function(…)
I can see that unregister is not a method on the registration object, so the registration object is not a ServiceWorkerRegistration

However, good tip to manually unregister it from chrome://serviceworker-internals/

Any method in the UpUp API to unregister a service worker? I can find only start(), addSettings() and debug().

The correct way of doing it is calling registration.unregister():

https://github.com/TalAter/UpUp/blob/master/src/upup.js#L126

The bad news is that UpUp doesn't expose registration.

Duplicate