I'm trying to optimize my application experience based on the kind of bandwidth the user has. For example, if the user is on a really slow 2G connection, I would render fewer graphics and less content, for high speed connections, I would include video, animations, etc.
Are there JS libraries that allow you to do this? What's the best practice?