{"_id":"@appearhere/universal-matchmedia-polyfill","_rev":"32-1b3adfc3020ad1a2fbd50c25437c1f98","name":"@appearhere/universal-matchmedia-polyfill","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@appearhere/universal-matchmedia-polyfill","version":"1.0.0","_id":"@appearhere/universal-matchmedia-polyfill@1.0.0","maintainers":[{"name":"rdjpalmer","email":"rich@rdjpalmer.com"}],"homepage":"http://github.com/appearhere/matchMedia.js","bugs":{"url":"https://github.com/appearhere/matchMedia.js/issues"},"dist":{"shasum":"d513853786c49731abb42bad6d9c7e071ab77b99","tarball":"https://registry.npmjs.org/@appearhere/universal-matchmedia-polyfill/-/universal-matchmedia-polyfill-1.0.0.tgz","integrity":"sha512-uttdx6w6M1ZhbzS8PPJvb/VxiUwbyvgJ84xQVDl3DEShT/iYo7O3kSGTF8yGIVz4MjSg//Aa46d2Ex95EiFKOw==","signatures":[{"sig":"MEQCIEPa5SqaK+zHx6ROQhniKT8+V6IOEx4pNhpdx4DjwXDyAiAkuqCeuWBWmle4/nvZLUcHCKTWtncdgSpkQtwWk7t5ww==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh11u8CRA9TVsSAnZWagAA0nwP/3K3WLMrPLAdgaIlJLG4\nS2lBTdv0hVOeH4Qdqn3kwa1imWCkuY/7njWWZyhvDRZbcBPi1WX9dUqpkAfJ\nVJiCXyn6JVaRRatOjrif44oZx3TrdX++TzHRvz2znodtE9dM8WwE5TDJ6AoL\nLxU89DqjfWqfWEi9dwC41E7AKwO483SZh4CO5aXAWVKb52JWAGwM2GU/1acm\nFYEx4VwLy9ppGTmdXFHHINzk2eh5wZ2OE2J6MK8mSFfncw/litobxs0Tu9XS\nW39SbcNB+8c55FORAp/GbH30WIgAYkw0qGzD3DSMWxN8a9KBw4bU86lRV0Xz\np10bNPuLOVfJl42iF4KHht3FP6D9fdVOPcOI5CTdmHE8AgJezmsnHnc73T06\ngXi8j4Rc35ch8XqanlaPb/p429CDCCzdrOG+l9QouGhWpO5sBSHZf8DH3Vv5\nOdRdZ+3nDFAhCJzeFFw3pDPQAT8xot4B6FOMDuWEnwiZE0/U93Z4A5IczkrO\npkhLs0xzay1Rf8++JsKHFbIodt9s/Y+CExz5G6vW3o1H5YGN6kG+CKbMUtFM\nA+PKCdR1ZFEZ0TyxOW6oHHXHSA7lVwt/DI+pdo/PCg1UJN0mAgRIAslFrJW6\n010mTyLihO5vrFKxDnDnzCLsrgKbwpA93qh8dWlZl9JSYHXAEVV8ZFVcMe1v\nelrC\r\n=fk+Y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./matchMedia.js","_from":".","config":{"access":"public"},"_shasum":"d513853786c49731abb42bad6d9c7e071ab77b99","gitHead":"5d3b07ec79025e906aa58f32b9c5fd2a6fbd41ce","scripts":{},"_npmUser":{"name":"rdjpalmer","email":"rich@rdjpalmer.com"},"repository":{"url":"git://github.com/appearhere/matchMedia.js.git","type":"git"},"_npmVersion":"3.10.3","description":"matchMedia polyfill for testing media queries in JS","directories":{},"_nodeVersion":"6.5.0","_npmOperationalInternal":{"tmp":"tmp/universal-matchmedia-polyfill-1.0.0.tgz_1476350920222_0.7802003943361342","host":"packages-12-west.internal.npmjs.com"}}},"time":{"created":"2016-10-13T09:28:42.079Z","modified":"2024-08-15T17:43:00.774Z","1.0.0":"2016-10-13T09:28:42.079Z"},"bugs":{"url":"https://github.com/appearhere/matchMedia.js/issues"},"homepage":"http://github.com/appearhere/matchMedia.js","repository":{"url":"git://github.com/appearhere/matchMedia.js.git","type":"git"},"description":"matchMedia polyfill for testing media queries in JS","maintainers":[{"email":"tech@appearhere.co.uk","name":"appearheretech"},{"email":"janie.amero@gmail.com","name":"jamero102"}],"readme":"# Universal matchMedia() polyfill\n\nPretty much exactly the same as [original matchMedia](https://github.com/paulirish/matchMedia.js) polyfill, but with the addition for a check of the existance of `window` and `document` so the polyfill can be used in an Universal (isomorphic) environment.\n\n## test whether a CSS media type or media query applies\n\n* **Original Authors**: Scott Jehl, Paul Irish, Nicholas Zakas\n* **Spec**: [dev.w3.org/csswg/cssom-view/#dom-window-matchmedia](http://dev.w3.org/csswg/cssom-view/#dom-window-matchmedia)\n* **Native support**: Chrome [since m10](http://trac.webkit.org/changeset/72552), Firefox [since 6](https://developer.mozilla.org/en/Firefox/Releases/6), and Safari [since 5.1](https://developer.mozilla.org/en/DOM/window.matchMedia#Browser_compatibility)\n\n### How about resizing the browser?\nPaul Hayes [tackled this using CSS transitions and their transitionEnd event](http://www.paulrhayes.com/2011-11/use-css-transitions-to-link-media-queries-and-javascript/)\n\nHis code: https://github.com/fofr/matchMedia.js -- though currently it doesnt support IE6-9, since they dont have transitions, obviously. :)\n\n\n## Usage\n\n#### test 'tv' media type\n    if (matchMedia('tv').matches) {\n      // tv media type supported\n    }\n\n### test a mobile device media query\n    if (matchMedia('only screen and (max-width: 480px)').matches) {\n      // smartphone/iphone... maybe run some small-screen related dom scripting?\n    }\n\n#### test landscape orientation\n    if (matchMedia('all and (orientation:landscape)').matches) {\n      // probably tablet in widescreen view\n    }\n\n\n## Used in:\n\n* [Respond.js](https://github.com/scottjehl/Respond)\n* [FormFactor](https://github.com/PaulKinlan/formfactor)\n* [Modernizr](http://www.modernizr.com/)\n","readmeFilename":"README.md"}