Get started with sw-toolbox CDN
Apache-2.0 licensed
Sw-Toolbox: Lightweight JS library for service workers, caching, offline.
Tags:- service
- worker
- collection
- toolbox
Stable version
Copied!
How to start using sw-toolbox CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with sw-toolbox CDN - cdnhub.io</title>
<script src="https://cdn.cdnhub.io/sw-toolbox/3.6.1/sw-toolbox.js"></script>
<link rel="manifest" href="manifest.json">
</head>
<body>
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', async () => {
const sw = await navigator.serviceWorker.register('service-worker.js');
sw.push('https://your-site.com/background-sync.html'); // Replace with your background sync page
await navigator.serviceWorker.ready;
await sw.registration.update();
navigator.serviceWorker.controller.postMessage({ type: 'REGISTER_SW_TOOLBOX' });
});
}
</script>
</body>
</html>
Copied!
Copied!