0.5.0 • Published 6 years ago

supports.js v0.5.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

⚡ Supports.js

Supports.js is a fast, lightweight and dependency-free feature-detection library. It's the best way to check a user's browser for those features that your latest projects make use of.

The aim of Supports.js is to make feature-detection quick and painless. Import what you need, and leave the rest. Everything returns a Boolean, for ease-of-use.

Getting Started

In the browser

<script src="//unpkg.com/supports.js/supports.min.js"></script>
if (supports.touchevents) {
  console.log('Touch events supported');
}

Using npm

$ npm i supports.js
import supports from 'supports.js';

if (supports.touchevents) {
  console.log('Touch events supported');
}

API Reference

Methods:

supports.some(args)

Example:

supports.some(['websqldatabase', 'webworkers', 'serviceworker']);

supports.every(args)

Example:

supports.every(['geolocation', 'touchevents', 'canvas']);

Properties:

supports.classlist
supports.devicemotion
supports.deviceorientation
supports.fetch
supports.filereader
supports.geolocation
supports.history
supports.intl
supports.matchmedia
supports.serviceworkers
supports.touchevents
supports.webgl
supports.webgl2
supports.webworkers

*NOTE Supports.js checks to see if Touch events are supported within a device browser. It relies on the browser to detect if touch support is available. It does NOT check to see if the device itself is a touch device.*

License

Supports.js uses the MIT license

Contributing

  1. Fork it (https://github.com/yourname/yourproject/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request