Could we have something like an update-widget? Or is there an easier way to update a filter every period of time than a ticker?

@EricShulman 's clock, for example needs a ticker in the background - that also updates when the clock is not visible - same for the alarms and the countdown
Could it be an idea to have something like

<$update timeout=1000>
<<now 0hh0mm>>
</$update>

…which only would render when it is visible.

Or is this a stupid idea and there are much easier ways to buid a clock or update a time calculation.

PS: When I am talking about desirable timebased TW features : Eric’s
<action-timeout delay="" />
would be something extremely usefull in the core

Please note that as of Sept 28th, 2022 (almost a year ago!), the TiddlyTools “timer.html” URL you linked is obsolete and no longer being actively updated for bug fixes, improvements, TWCore upgrades, etc.

All TiddlyTools add-ons are now distributed and maintained directly at https://tiddlytools.com and the proper link to use for information about time-related add-ons is https://tiddlytools.com/#TiddlyTools%2FTime%2FInfo

-e

1 Like

Thank you @EricShulman - but for the question nothing has changed? A ticker still would be the way to go to have an updating filter or nowmacro…or am I wrong with this?

TiddlyTools/Time/Ticker is a StartupAction that invokes

<$action-timeout interval="1000" actions=<<ticker_actions>> />

to automatically trigger a <<ticker_actions>> macro once per second.

One of the actions that is performed by the <<ticker_actions>> macro is:

<$action-setfield $tiddler="$:/temp/time/ticker" text=<<now [UTC]YYYY0MM0DD0hh0mm0ss0XXX>>/>

which saves the current TWCore 17-digit UTC datetime stamp in $:/temp/time/ticker.

As a result, there is an interesting “live update” side-effect that can be easily achieved without needing to use any additional $action-timeout widgets…

Each time the contents of $:/temp/time/ticker changes, the TWCore’s refresh mechanism “broadcasts” a global refresh event to all top-level rendered widgets. This refresh event is extremely optimized to only trigger re-rendering of widget content that is dependent upon changes to specified tiddler field values or calculated variables.

Try this:

Go to https://TiddlyTools.com and enable editing (click the “lock” toolbar icon in the upper-right corner of the page). Then create a new tiddler containing the following wikitext:

<<now 0hh:0mm:0ss.0XXX>>

This displays the current local time (including milliseconds). Note that the time display is only updated when that tiddler needs to be re-rendered, so the time that you see does not change unless you force a refresh of that tiddler’s content (e.g., by closing and re-opening the tiddler).

Next, change the tiddler’s content to:

<$let tick={{$:/temp/time/ticker}}><<now "0hh:0mm:0ss.0XXX">></$let>

Note that the value of the tick variable depends the contents of $:/temp/time/ticker. This creates a “refresh dependency” for the wikitext contained within the <$let>...</$let> widget (i.e., the <<now>> macro).

Since the $:/temp/time/ticker content is being updated once per second (because of the <$action-timeout> that was triggered by the TiddlyTools/Time/Ticker StartupAction), the <<now "0hh:0mm:0ss.0XXX">> macro gets automatically re-rendered, resulting in a “live” clock display that is updated once per second.

This same technique can be applied to ANY wikitext content (not just the <<now>> macro), simply by enclosing it inside <$let tick={{$:/temp/time/ticker}}>...</$let>.

enjoy,
-e

2 Likes

@EricShulman, thanks for this trick I did not know that this would cause a rerendering even if the variable is not used inside…

Hi @EricShulman I used your trick in my
schedule tiddlers

But the loop gets stuck from time to time. What did I do wrong and what can I do against this?