You can construct a widget that refreshes whenever the viewport size changes using the DynaView plugin. It maintains a state tiddler $:/state/DynaView/ViewportDimensions/ResizeCount that contains a count that is incremented at each refresh. Widgets can check for modifications to that tiddler in their refresh method. For example:
if(changedTiddlers["$:/state/DynaView/ViewportDimensions/ResizeCount"]) {
foo()
}
The DynaView plugin also saves the viewport size in the tiddlers $:/state/DynaView/ViewportDimensions/Width and $:/state/DynaView/ViewportDimensions/Height, although it doesn’t track changes to the rendered document size.
The DynaView plugin can be installed from the official plugin library, and you can try it out here:
Best wishes
Jeremy.