← सभी कोड फ़ाइलें

sw.js

बुनियादी service worker: shell को precache करें और cache-first परोसें।

const CACHE = 'app-v1';
const ASSETS = ['/', '/index.html', '/styles.css', '/app.js'];

self.addEventListener('install', (e) => {
  e.waitUntil(caches.open(CACHE).then((c) => c.addAll(ASSETS)));
});

self.addEventListener('fetch', (e) => {
  e.respondWith(caches.match(e.request).then((hit) => hit || fetch(e.request)));
});

इस टूल के बारे में

बुनियादी service worker: shell को precache करें और cache-first परोसें।

उपयोग के लिए तैयार sw.js — सामग्री देखें, कॉपी करें, या सही फ़ाइल नाम के साथ डाउनलोड करें। मुफ़्त और 100% ब्राउज़र में।