Last active
October 20, 2018 18:54
-
-
Save leMaur/a65c4ec7eb5ede963ef4c66821ff1ed6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function () { | |
| // set default ratio value | |
| let ratio = 1; | |
| // use systemXDPI and logicalXDPI if available | |
| if (window.screen.systemXDPI !== undefined | |
| && window.screen.logicalXDPI !== undefined | |
| && window.screen.systemXDPI > window.screen.logicalXDPI) { | |
| ratio = window.screen.systemXDPI / window.screen.logicalXDPI; | |
| } | |
| // use devicePixelRatio if available | |
| else if (window.devicePixelRatio !== undefined) { | |
| ratio = window.devicePixelRatio; | |
| } | |
| if (typeof define === 'function' && define.amd) { | |
| define(ratio.toFixed(1)); | |
| } else { | |
| window.DPR = ratio.toFixed(1); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment