fetch-topics.js (438B)
1 self.addEventListener('message', event => { 2 if (event.data.fetchUrl) { 3 clients.matchAll().then((clients) => { 4 fetch(event.data.fetchUrl, {browsingTopics: true}).then((response) => { 5 response.text().then((topics_header) => { 6 // clients[0] is the most recently focused one 7 clients[0].postMessage({ 8 topicsHeader: topics_header 9 }); 10 }); 11 }); 12 }); 13 } 14 });