bigslycat / mq-polyfill

CSSOM-valid and jsdom/Jest-compatible matchMedia server-side polyfill.
https://www.npmjs.com/package/mq-polyfill
MIT License
29 stars 5 forks source link

Missing Support for addEventListener/removeEventListener #7

Open DaleSeo opened 4 years ago

DaleSeo commented 4 years ago

The addListener and removeListener methods of MediaQueryList are deprecated and using them now causes linting errors as seen below.

image

I'd like to request adding support for the addEventListener and removeEventListener methods so that they can be used instead as recommended on MDN.

This method exists primarily for backward compatibility; if possible, you should instead use addEventListener() to watch for the change event.

https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList

TatisLois commented 3 years ago

I just ran into the same issue. If it's alright with @bigslycat I can open a PR with support.

TatisLois commented 3 years ago

@bigslycat @fuller going to work on a PR to update the lib.