Service Worker
Domain: Internet & Web
🎯 Motivation
A script that runs in the background, enabling offline functionality, push notifications, and caching for PWAs.
📋 Concrete Example
Service worker: intercepts network requests. If offline: serves cached files. If online: fetches fresh data. Runs even when the page is closed. Enables push notifications.
🔗 Analogy
A service worker is like a night security guard - they work even when the store (page) is closed. They handle incoming requests (visitors), check inventory (cache), and call for backup (fetch from network) when needed.