Eric, This worked perfectly! Thanks for the widget and the instructions.
On Saturday, June 26, 2021 at 11:57:27 PM UTC-5 Eric Shulman wrote: > On Saturday, June 26, 2021 at 8:05:15 PM UTC-7 Soren Bjornstad wrote: > >> Has anyone found a way to make TiddlyWiki re-render a part of the page >> template periodically? > > I'd like to have a section in my page template that does a calculation >> based on the current time, and would love if I didn't have to click a >> button all the time to update it. > > Maybe some kind of event that's scheduled in JavaScript and fires every >> minute? > > > My TiddlyTools Timer functions can do this. > > 1) Copy the $action-timeout widget from > > http://tiddlytools.com/timer.html#TiddlyTools%2FTime%2Faction-timeout.js > <http://tiddlytools.com/timer.html#TiddlyTools%2FTime%2Faction-timeout.js> > > 2) Create a "MinuteTickerStartup" tiddler, tagged with > *$:/tags/StartupAction*, containing: > \define minute_ticker() <$action-setfield > $tiddler="$:/temp/time/minuteticker" text=<<now [UTC]0hh0mm0ss>> /> > <$action-timeout interval=60000 actions=<<minute_ticker>> /> > > 3) In a tiddler tagged with *$:/tags/PageTemplate*, put the content you > want to automatically re-render each minute, like this: > <$vars ticker={{$:/temp/time/minuteticker}}> > *** content you want to re-render *** > </$vars> > > Notes: > 1) MinuteTickerStartup is invoked *once* when you load your TiddlyWiki > and sets up an javascript "interval" timer that is triggered every minute > (60000 milliseconds) > 2) The ticker action updates the contents of *$:/temp/time/minuteticker* to > contain the current time (0hh0mm0ss) > 3) The $vars "wrapper" in the page template tiddler creates a refresh > dependency associated with the current value in > *$:/temp/time/minuteticker* > > The result is that whatever content is in your page template will be > re-rendered once per minute. Q.E.D. > > enjoy, > -e > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/5d586d13-48f6-4e44-b06c-be92e55b8461n%40googlegroups.com.

