Javascript detect retina screen (javascript detect device pixel ratio / density)
npm install javascript-retina-detect
npm install javascript-retina-detect --save
`
Usage
`js
import { device_pixel_ratio } from 'javascript-retina-detect'
device_pixel_ratio()
// 1 for normal screens
// 2 for retina@2x
// 3 for retina@3x
// …
`
Contributing
After cloning this repo, ensure dependencies are installed by running:
`sh
npm install
`
This module is written in ES6 and uses Babel for ES5
transpilation. Widely consumable JavaScript can be produced by running:
`sh
npm run build
`
Once npm run build has run, you may import or require() directly from
node.
After developing, the full test suite can be evaluated by running:
`sh
npm test
`
While actively developing, one can use (personally I don't use it)
`sh
npm run watch
`
in a terminal. This will watch the file system and run tests automatically
whenever you save a js file.
When you're ready to test your new functionality on a real project, you can run
`sh
npm pack
`
It will build, test and then create a .tgz archive which you can then install in your project folder
`sh
npm install [module name with version].tar.gz
``