css_browser_selector
css_browser_selector copied to clipboard
Performance issue on window resize event
I would suggest to debounce the resize event and maybe orientationchange too. The other option could be instead of modifying className which may cause constantly reflow (as far I know), could be replaced with classList https://developer.mozilla.org/en-US/docs/Web/API/Element/classList
window.addEventListener('resize', updateScreen);
window.addEventListener('orientationchange', updateScreen);