{"author":{"name":"Scott Jehl"},"name":"matchmedia-polyfill","description":"matchMedia polyfill for testing media queries in JS","license":"MIT","version":"0.3.2","homepage":"http://github.com/paulirish/matchMedia.js","repository":{"type":"git","url":"git://github.com/paulirish/matchMedia.js.git"},"main":"./matchMedia.js","gitHead":"3508a0aed9a4fad326b69af6fcf6a0da52d84984","bugs":{"url":"https://github.com/paulirish/matchMedia.js/issues"},"_id":"matchmedia-polyfill@0.3.2","_nodeVersion":"11.13.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-B2zRzjqxZFUusBZrZux59XFFLoTN99SbGranxIHfjZVLGZuy8Iaf/s5iNR3qJwRQZBjBKsU6qBSUCltLV82gdw==","shasum":"4666e252aead72e8dd232a9fbde5d93fa50497d3","tarball":"http://registry-npm.ywwl.com/matchmedia-polyfill/download/matchmedia-polyfill-0.3.2.tgz","fileCount":5,"unpackedSize":7754,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc0hioCRA9TVsSAnZWagAAPJsQAIGZ1bIRJCn4M417ccSS\nCuyKVIM0m2Hs6s7hwKt6k/q2WB8VSMKscFRgFKej9XT5o8Ii84quPSdFsOI9\n91pXhP4h3z/jd3elrGOqaKlg1PDR6yP2IwxwlCk0VojGnYdUuyw4LDtn2HzL\nNIN1YKrAXcOPOjwVMX2QlgcBDB0MIboLuojt8w94KY1JQBoskqnp8120Ezfp\nNX/bHaVl9XtgXscCez3j2X10JFPSH6dmLmtxqsh9drqB6iJoPNLKONqCMSMp\nTyT58SF2FMHsrTC/44zR7/Y9zxqe+yBoBiAc/mJ4EywdDJBxVwLaL0tRvQgi\nrHT6AJ8wVcrU+VfYjpgQwy4v+VbuaFaFGS54+40tvc3QM4C7GAgRIJF6ZE+g\n0CMgRrBXd2SsQMmz9HxrpVK8jbh3fWzOA9reVMBqPmLl5EtTQghXbLBXc5VP\nwAwVpiuif3wMX9A/Dmq6NeNbAYro9/oie5SgvdBwypFmJ6zzEzhWpKpv42Rz\nErfxx1SVUMI5oHwU2RuZ2T9GoNSnBLc16XYD/yQ7/X6MWUDeRbbAtfPiILzV\nwenCEJy8ecXUL9uZXkKrZ5Xo6f4yTiguedYogyfzs3Az4/REyXdNKd2Wrzuc\nt4O7cJsf7tG5LWJYl95qBdBFAyQ5Z6ahbXvbW2NX9MhjlmU1cZ7/a6ggNLhY\nR6Ek\r\n=67z5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEuMXPbYKVjnqfivjpXuxNYe49XfXgcFHETexkkEYes9AiEAtEt/IuBxJu4c4gTwqDvi2DeWwz3Ya6agILyE1MtDzkI="}],"size":3232,"noattachment":false,"key":"/matchmedia-polyfill/-/matchmedia-polyfill-0.3.2.tgz"},"maintainers":[{"email":"paul.irish@gmail.com","name":"paulirish"},{"email":"scott@filamentgroup.com","name":"scottjehl"}],"_npmUser":{"name":"paulirish","email":"paul.irish@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/matchmedia-polyfill_0.3.2_1557272744256_0.4368602710980609"},"_hasShrinkwrap":false,"readme":"[![npm](https://img.shields.io/npm/v/matchmedia-polyfill.svg)](https://npmjs.com/package/matchmedia-polyfill)\n\n# matchMedia() polyfill\n\n## test whether a CSS media type or media query applies\n\n## Usage\n\n```js\n// Likely want to requier both polyfills..\nrequire('matchmedia-polyfill');\nrequire('matchmedia-polyfill/matchMedia.addListener');\n```\n\n#### test 'tv' media type\n```js\nif (matchMedia('tv').matches) {\n  // tv media type supported\n}\n```\n\n### test a mobile device media query\n```js\nif (matchMedia('only screen and (max-width: 480px)').matches) {\n  // smartphone/iphone... maybe run some small-screen related dom scripting?\n}\n```\n\n#### test landscape orientation\n```js\nif (matchMedia('all and (orientation:landscape)').matches) {\n  // probably tablet in widescreen view\n}\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\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\n* **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","publish_time":1557272744375,"_cnpm_publish_time":1557272744375,"dist-tags":{"latest":"0.3.2"}}