14 lines
438 B
JavaScript
14 lines
438 B
JavaScript
self.addEventListener('message', event => {
|
|
if (event.data.fetchUrl) {
|
|
clients.matchAll().then((clients) => {
|
|
fetch(event.data.fetchUrl, {browsingTopics: true}).then((response) => {
|
|
response.text().then((topics_header) => {
|
|
// clients[0] is the most recently focused one
|
|
clients[0].postMessage({
|
|
topicsHeader: topics_header
|
|
});
|
|
});
|
|
});
|
|
});
|
|
}
|
|
});
|