How to pass data from localstorage serviceworker?

var CACHE_NAME = 'my-site-cache-v1';
var urlsToCache = [
'https://www.google.com/s2/favicons?domain=130.ua'
];
self.addEventListener('install',function(event){
event.waitUntil(caches.open(CACHE_NAME).then(function(cache){
 console.log('Opened cache', urlsToCache);
 return cache.addAll(urlsToCache);
}));
});

It looks like sw.js
I need to make in the body of the document urlsToCache variable contains addresses or receive the addresses from localStorage. How to do it ?
localStorage is not available in sw.js.
March 19th 20 at 08:32
1 answer
March 19th 20 at 08:34
Need to add custom event in which you for example can pluralise these same data and put them wherever you want.

Find more questions by tags JavaScript