Coming from this discussion :
I have created a demo of handling the resize event in JS and sending the result back to Anvil :
I needed to be able to switch to a different form if on a mobile sized page.
As with everything I post, use with caution please!