uc-detective
v1.1.0
Published
Collection of super fast browser feature tests
Maintainers
Readme
Unchained UI
Detective
Collection of simple browser features detection functions
Usage
Just import features you need to check
import { requestAnimationFrame, isHDPI } from 'uc-detective'Features
- requestAnimationFrame — function, prefixed or polyfill
- isCSSOM — boolean, CSSOM is supported
- transform — string, prefixed
- transition — string, prefixed
- transitionEnd — string, prefixed
- browser
- name
- version
- isHDPI — boolean, when devicePixelRatio > 1
- is2x — boolean, when devicePixelRatio > 1.5 but less than 2.5
- is3x — boolean, when devicePixelRatio > 2.5
- isSmaller(size) – boolean, returns true when screen width of height less than size
- isLarger(size) – boolean, returns true when screen width of height larfer than size
- isTouch – boolean
- isGeolocation – boolean
Helpers
hdpiImg(imgObj, name, defaultImg)
return coresponded data from the imgObj. If imgObj is false returns optional defaultImg. Example:
import { hdpiImg } from 'uc-detective'
const image = {
'thumb': { url: '/some/image.jpg' },
'thumb@2x': { url: '/some/image.jpg' }
}
console.log(hdpiImg(image, 'thumb').url)
License MIT
© velocityzen
