Scittle Service Worker Template
July 1, 2025 ยท View on GitHub
This repository demonstrates how to use a service worker with Scittle.
You can also clone this repo and use it directly as a template.
How to use
To add a Scittle-powered service worker to your project:
-
Copy
scittle-sw.jsto your project's root directory. -
Create your service worker logic in a ClojureScript file (e.g.,
sw.cljs). -
Register the service worker in your main HTML file (e.g.,
index.html) by adding a script tag.<script> if('serviceWorker' in navigator) { navigator.serviceWorker.register('scittle-sw.js?libs=promesa,js-interop&script=sw.cljs'); } </script>
scittle-sw.js Configuration
The scittle-sw.js script is a generic loader for any Scittle service worker script. It is configured via URL query parameters.
script: The path to your ClojureScript service worker file. Defaults tosw.cljs.libs: A comma-separated list of Scittle libraries to load in the service worker context (e.g.,promesa,reagent,js-interop).