Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 1.5 KB

readme.md

File metadata and controls

58 lines (39 loc) · 1.5 KB

Unchained UI

Detective

NPM Version NPM Downloads

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