Closed iazel closed 9 years ago
How is it not "native"? The lib relies on the matchMedia API which has very broad support these days. Polyfills are only required for IE 9 and below. Also it is far more flexible and future-propf than your proposed API eg. How would you handle pixel density, or height, or AND or OR queries or any other type of query that may arise in future (eg touch or brightness)?
You could simply add more keys in the first object, but thinking about it, you're right: that would be a waste of time, reinventing the wheel.
I like the project's idea, but I was wondering, why media query instead of a more native approach using an object?
Something like this:
This would completely remove the need for polyfills and should be quite straightforward to code.
I think the first object should have three mode, namely
min
,max
orin
; the latter is more a sugar and could be dropped out in favor of{min: x, max: y}