dark-mode-example icon indicating copy to clipboard operation
dark-mode-example copied to clipboard

Deprecated code.

Open 23Chromosomes opened this issue 5 years ago • 1 comments

// Listen for changes in the OS settings useDark.addListener(function(evt) { toggleDarkMode(evt.matches); });

Should use addEventListener to future proof the code.

23Chromosomes avatar Jul 19 '21 15:07 23Chromosomes

@23Chromosomes Thanks for the suggestion. The reason we used the deprecated version is because older versions of Safari (both on iOS and macOS) don't support addEventListener. Newer versions do though, but to be properly backwards-compatible the best approach would be to check if addEventListener exists on MediaQueryList and use the one that exists.

spinn avatar Jul 26 '21 09:07 spinn