'Does IndexedDB persist with a new service-worker?

Does the indexedDB persist when I unregister a service worker and install a new one?

If I would manually unregister the service-worker like this

        navigator.serviceWorker
          .getRegistrations()
          .then(function (registrations) {
            for (let registration of registrations) {
              registration.unregister();
            }
          });
        window.location.reload();
      

what happens with the indexedDB that is created in my service worker? Is it dependent on the specific sw it was created in?



Solution 1:[1]

Unregistering a service worker does not affect site storage, and that includes IndexedDB and the Cache Storage API. All previously saved data will persist independent of a service worker registration.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeff Posnick