Collection of simple browser features detection functions
Just import features you need to check
import { requestAnimationFrame, isHDPI } from 'uc-detective'
- 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
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