Skip to content

unchainedui/detective

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Collection of fast browser feature tests

Resources

License

Stars

Watchers

Forks

Packages

No packages published