Hi Adam

> I'm trying to build a widget that fills a state tiddler with information 
> about the window and document dimensions. I'm wanting to refresh the widget 
> whenever the window is resized or document offsetHeight changes, rather than 
> whenever a tiddler is changed. Anyone know of any way to do that?

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:

https://tiddlywiki.com/plugins/tiddlywiki/dynaview/#%24%3A%2Fplugins%2Ftiddlywiki%2Fdynaview

Best wishes

Jeremy.


> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/tiddlywikidev 
> <https://groups.google.com/group/tiddlywikidev>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywikidev/0fc3e356-e1a3-4272-a367-36ff6fc1e1af%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywikidev/0fc3e356-e1a3-4272-a367-36ff6fc1e1af%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/CD0C9D8A-6688-4975-91E5-50B928FB6A08%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to