about
Helps detect browser features.
setup
Download from the npm registry:
# Contains named exports for a range of newer browser features
npm install sports
usage
Do I have the EventSource API available on this browser?
import { eventsource } from "sports"
// Implicitly tries `'EventSource' in window`
if (eventsource()) {
console.log("Fortunately yes")
}
What checks and features are available in all?
import * as sports from "sports"
Object.entries(sports).forEach(([feature, check]) => {
console.log(feature, check())
})