Add service worker for caching system

This commit is contained in:
Danny Spina
2023-06-23 16:16:35 +02:00
parent 9c50cb2c0d
commit 413e88b5cc
8 changed files with 280 additions and 37 deletions

12
dist/index.html vendored
View File

@@ -8,6 +8,7 @@
name="description"
content="Blaze: The search engine for seamless browsing in challenging connections. Discover fast results and access online content efficiently."
/>
<meta http-equiv="Cache-control" content="public" />
<title>Blaze</title>
<style>
body {
@@ -62,6 +63,17 @@
t.addEventListener("click", () => {
location.href = e + "?q=" + encodeURIComponent(c.value);
});
if ("serviceWorker" in navigator) {
navigator.serviceWorker
.register("/service-worker.js")
.catch((error) => {
console.log(
"Something went wrong with installation of the service worker:",
error
);
});
}
</script>
</body>
</html>