matchMedia polyfill for testing media queries in JS
npm install @appearhere/universal-matchmedia-polyfillPretty much exactly the same as original matchMedia 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.
* Original Authors: Scott Jehl, Paul Irish, Nicholas Zakas
* Spec: dev.w3.org/csswg/cssom-view/#dom-window-matchmedia
* Native support: Chrome since m10, Firefox since 6, and Safari since 5.1
His code: https://github.com/fofr/matchMedia.js -- though currently it doesnt support IE6-9, since they dont have transitions, obviously. :)
#### test 'tv' media type
if (matchMedia('tv').matches) {
// tv media type supported
}
#### test landscape orientation
if (matchMedia('all and (orientation:landscape)').matches) {
// probably tablet in widescreen view
}