I'd like to detect widnow resize event using ResizeObserver
currenlty I use
window.addEventListener('resize',() => console.log('resize'));
I want to refactor it and use ResizeObserver. Is it possible?
You can observe document.body
.
new ResizeObserver(() => {
console.log('resized')
}).observe(document.body)