Closed Maxim-Mazurok closed 5 years ago
Thanks @Maxim-Mazurok!
So, I just found out that it's not supported in Safari on Mac OS. I tried 13.0 and 13.1 (TP).
Both of them only know addListener
for MediaQueryList
, unfortunately.
It's not working on my iOS devices also (iOS 12.4).
You might want to revert this change or make it part of the major release, introducing a breaking change. Sorry about that...
Well that's weird, I glanced over the browser compatibility source you shared and it looked pretty good. Thanks for the heads up, at least I hadn't published to npm yet 😁
Yeah, they support addEventListener
in general, but not for the MediaQueryList
, unfortunately.
Here's a relevant issue: https://github.com/microsoft/TypeScript/issues/32210
BTW, the best way to see the browser support for these particular methods is to go to MDN:MediaQueryList#Browser_compatibility and check out MediaQueryList inheriting from EventTarget
section of the table. Thanks to https://github.com/mdn/browser-compat-data/pull/3674 for making this contribution.
Reverted, thanks again for the heads up :pray:
Good news for Safari: addEventListener
was added for MediaQueryList
in Safari 14.0 TP (Release 109 (Safari 14.0, WebKit 15610.1.17.2)
)
addListener
andremoveListener
are deprecated in a favor ofaddEventListener
andremoveEventListener
.From MediaQueryList/addListener
They are supported by all major browsers: EventTarget/addEventListener
BTW,
TSLint
is producing the following error when trying to useaddListener
: