AbsoluteJS

absolutejs-service-worker-example

absolutejs-service-worker-examplev0.0.1betaDev Tools

A 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.

#Installation

BASH
# Private workspace project: ~/abs/examples/service-worker

#Capabilities

Overview

A 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.

Features

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

Show 2 more

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

Getting Started

Prerequisites: Bun

Then open the app in your browser. Each framework demo is available at its own route:

Route — Framework

Show 5 more

/ — React

/svelte — Svelte

/vue — Vue

/angular — Angular

/html — Vanilla HTML

How the Service Worker Works

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

Show 2 more

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

What you can build

Build on the supported package contract

Use absolutejs-service-worker-example through its supported public entry points.

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed absolutejs-service-worker-example version, replace example or memory-backed dependencies with durable implementations, bound external calls, protect credentials, and emit enough evidence to retry or recover safely.

Follow in order

Troubleshooting path

1
Trace from the first failed boundary
Reproduce the smallest canonical absolutejs-service-worker-example example, confirm the supported entry point and version in the API explorer, then inspect the first boundary that did not produce its documented result.

#Production Build

Partial snippet

Working example for Production Build.

BASH
bun run compile   # Compile server to single executable
bun start         # Start production server

#Getting Started

Partial snippet

Prerequisites: Bun

BASH
# Install dependencies
bun install

# Start development server
bun run dev

#Other Commands

Partial snippet

Working example for Other Commands.

BASH
bun run typecheck  # TypeScript type checking
bun run lint       # ESLint
bun run format     # Prettier

#Package commands

Scripts declared by this package manifest.

bun run devabsolute dev
bun run formatabsolute prettier --write
bun run lintabsolute eslint
bun run startabsolute start
bun run typecheckabsolute typecheck
Private workspace project
This project is maintained inside the workspace and is not published as a standalone npm package.