TalAter / UpUp

✈️ Easily create sites that work offline as well as online
https://www.talater.com/upup/
MIT License
4.88k stars 264 forks source link

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

Closed ovidiugabriel closed 8 years ago

ovidiugabriel commented 8 years ago

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.

ovidiugabriel commented 8 years ago

How do I unregister/stop the service worker?

ovidiugabriel commented 8 years ago

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

ovidiugabriel commented 8 years ago

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

ovidiugabriel commented 8 years ago

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

hnordt commented 8 years ago

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.

TalAter commented 8 years ago

Duplicate