Build on the supported package contract
Use absolutejs-service-worker-example through its supported public entry points.
absolutejs-service-worker-examplev0.0.1betaDev ToolsA multi-framework demonstration of Service Worker capabilities built with AbsoluteJS. The same interactive demo is implemented in React, Vue, Svelte, Angular, and vanilla HTML — all served from a single application.
# Private workspace project: ~/abs/examples/service-workerA multi-framework demonstration of Service Worker capabilities built with AbsoluteJS. The same interactive demo is implemented in React, Vue, Svelte, Angular, and vanilla HTML — all served from a single application.
Registration & Lifecycle — Register/unregister service workers and track state transitions in real time (installing → activated → redundant)
Cache Management — Precache URLs on install, cache on demand, inspect cached items, and delete individually or clear all
Message Passing — Ping the service worker and measure round-trip latency via MessageChannel
Fetch Interception — Cache-first strategy for assets, network-first for navigation with offline fallback
Offline Support — Test cached vs uncached resources offline with graceful error handling
Prerequisites: Bun
Then open the app in your browser. Each framework demo is available at its own route:
Route — Framework
/ — React
/svelte — Svelte
/vue — Vue
/angular — Angular
/html — Vanilla HTML
The service worker (src/backend/sw.ts) is served at /sw.js with the appropriate Service-Worker-Allowed header. It implements:
Install — Precaches a configurable list of URLs and broadcasts status updates to all clients
Activate — Cleans up old caches and claims all open clients
Fetch — Cache-first for /assets/ paths, network-first for navigation requests with an offline fallback page
Messages — Handles ping/pong, cache CRUD operations, and status queries via postMessage
Outcomes
Use absolutejs-service-worker-example through its supported public entry points.
Hardening checklist
Follow in order
Working example for Production Build.
bun run compile # Compile server to single executable
bun start # Start production serverPrerequisites: Bun
# Install dependencies
bun install
# Start development server
bun run devWorking example for Other Commands.
bun run typecheck # TypeScript type checking
bun run lint # ESLint
bun run format # PrettierScripts declared by this package manifest.