Get Plugin dimension on ready and resize event

Hello,

My UXP Plugin with Vanilla JS has a sp-body in which I’m fetching content using XMLHttpRequest and showing the response using innerHTML.

Now I have set fixed dimension for that, but how can I set the width and height dynamically to match the Plugin Panel in case of resize? Can I get the width and height value with events like onload and onresize like we used to do in JS? thanks!