Offline is a JavaScript library that provides an offline-first framework for web applications, centered on monitoring network connectivity and managing the application's response to connection state changes. It detects transitions between online and offline states by listening to browser events and emits custom events that allow other parts of the application to react accordingly.
The library distinguishes itself by combining event-driven connectivity detection with automatic request queuing and retry. When a request fails due to lost connectivity, it is captured and queued in memory, then automatically replayed in order once the network connection is restored. It also includes periodic connectivity probing, which sends lightweight HTTP requests to a known endpoint to verify actual network reachability beyond the browser's own event signals.
Offline provides a visual status indicator that automatically updates to reflect the current online or offline state, and its custom event bus enables decoupled components to respond to connection up, down, and reconnection attempts. The library's documentation covers installation and integration for adding these capabilities to web applications.