Simple static web app that shows live inbound departures for Sydenham Station by fetching data from the TfL (Transport for London) Unified API.
It also registers a service worker (sw.js) to cache basic assets for offline/slow-network use (PWA-style).
- Filters arrivals to only those whose
directionisinbound - Sorts by
expectedArrival - Shows time remaining in minutes (e.g.
3 min) orDueif the departure time has passed - Refreshes the departures list every 60 seconds
The data source is configured in index.html inside the fetchDepartures() function:
stopPoint(currently910GSYDENHM)lineId(currentlywindrush)
If you need a different stop or line, update the fetch URL in index.html.
Because this is a static site, you can serve it with any local static server.
Example (Python):
python3 -m http.server 8000Then open:
http://localhost:8000
- The page registers
/sw.json load (navigator.serviceWorker.register('/sw.js')). - For the service worker to work correctly:
- Use HTTPS in production, or
- Use
http://localhostwhen testing locally.
manifest.jsonreferences icon files (icon-192.png,icon-512.png). Those files are expected to exist in the site root.- If you don’t have them, update the
iconssection ofmanifest.json(or add the missing PNGs).
- If you don’t have them, update the
Add a license header/file if you plan to publish this project.