I'm making use of matchMedia().addListener
to detect dark/light mode theme preference changes in Safari, however in WebStorm using addListener
is marked as deprecated but simply says to refer to documentation for what should replace it.
I've had a read through the MDN docs and I don't understand what event type I should be listening for in addEventListener
to replace addListener
?
window.matchMedia("(prefers-color-scheme: dark)").addListener(() => this.checkNative());
window.matchMedia("(prefers-color-scheme: light)").addListener(() => this.checkNative());