Obs.js is a tiny JavaScript library that provides context-aware signals about your user's environment.
It uses the Navigator and Battery APIs to add CSS classes and a JS object you can use to adapt your site's performance.
Key features:
- Detects slow connections and low battery.
- Infers device capability (RAM/CPU).
- Provides simple CSS classes (
.has-battery-low
) and a JS object (window.obs
). - No dependencies, just a single inline script.
It's a smart way to conditionally load assets or disable heavy features for users who need a lighter experience.
๐ Blog Post
๐ GitHub Repo
๐ Live Demo
Top comments (0)