A function that attaches a ResizeObserver to any given element, so it is very efficient.
ResizeObserver
import {html, defineElement, attachOnResize} from 'element-vir';const MyElement = defineElement()({ tagName: 'my-element', render({host}) { attachOnResize(host, (size, element) => { console.log('resized!', element, size); }); return ''; },}); Copy
import {html, defineElement, attachOnResize} from 'element-vir';const MyElement = defineElement()({ tagName: 'my-element', render({host}) { attachOnResize(host, (size, element) => { console.log('resized!', element, size); }); return ''; },});
A function that attaches a
ResizeObserverto any given element, so it is very efficient.