{"author":{"name":"Scott Jehl"},"name":"matchmedia-polyfill","description":"matchMedia polyfill for testing media queries in JS","version":"0.3.0","homepage":"http://github.com/paulirish/matchMedia.js","repository":{"type":"git","url":"git://github.com/paulirish/matchMedia.js.git"},"main":"./matchMedia.js","gitHead":"cda14dfeec36cfd83a7f13298c16b92c6ca85403","bugs":{"url":"https://github.com/paulirish/matchMedia.js/issues"},"_id":"matchmedia-polyfill@0.3.0","scripts":{},"_shasum":"6f91e34012b3dfc9d5b76cec89deafc1b41b45fa","_from":".","_npmVersion":"3.3.11","_nodeVersion":"0.10.31","_npmUser":{"name":"scottjehl","email":"scott@filamentgroup.com"},"dist":{"shasum":"6f91e34012b3dfc9d5b76cec89deafc1b41b45fa","tarball":"http://registry-npm.ywwl.com/matchmedia-polyfill/download/matchmedia-polyfill-0.3.0.tgz","integrity":"sha512-Yz9NzSn1pSMDyHyQoeKJ2V7/2mapCRSRg1XL62Egs8Rxa2wwQbShiviWmxtdxa9MwCKp74qlEWEaQuphA6hkCA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIC54/u4EYVWx3y8mr0PxImKlnluMlKyMODs4ZFRwXOtgAiEAylT14xh+C5CoRCmFqpQNRzBevQU2PV7rJMNj9AGCD6k="}],"size":10319,"noattachment":false,"key":"/matchmedia-polyfill/-/matchmedia-polyfill-0.3.0.tgz"},"maintainers":[{"name":"scottjehl","email":"scott@filamentgroup.com"}],"directories":{},"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":1452027045877,"_cnpm_publish_time":1452027045877,"dist-tags":{"latest":"0.3.2"}}