I found this snippet in a thread
I could not find this in the docs and have been using Jeds delay-action-plugin so far.
It would be very practical if this was a core feature and if it was documented.
I found this snippet in a thread
I could not find this in the docs and have been using Jeds delay-action-plugin so far.
It would be very practical if this was a core feature and if it was documented.
The delay is not supported by the core and unlikely to to be a core feature, see Add an optional delay to the tm-focus-selector action by BurningTreeC ¡ Pull Request #6606 ¡ Jermolene/TiddlyWiki5 ¡ GitHub
Hi @JanJo ,
In my multi-column Layout Iâve added this delay to the tm-focus-selector
message so that I can focus an input thatâs not yet animated into view when a button is clicked.
This is not a tiddlywiki core feature.
Best wishes,
Simon
Aaah thanks!
There are some widgets where it would be great to have the possibility to delay the actions.
action-sendmessage,
action-setfield,
âŚ
Perhaps it would be an idea simply to have an action-delay-widget that could put between two widgets?
see:
https://tiddlytools.com/timer.html#TiddlyTools%2FTime%2Faction-timeout.js
<$action-timeout delay=nnnn actions=... />
.<$action-timeout interval=nnnn actions=... />
.delay
and interval
are specified in milliseconds (a non-zero numeric value is required).actions
can be specified using quoted text or a macro reference.<$action-timeout>
widget within a <$button>
widget. Interrupt-driven timeout processing will start when you click on the button.<$action-timeout>
widget in a tiddler tagged with $:/tags/StartupAction/Browser. Interrupt-driven timeout processing will automatically start when you save-and-reload your TiddlyWiki file.<$action-timeout>
widget in any tiddler and add an autostart="yes"
param to the widget. Interrupt-driven timeout processing will automatically start each time the tiddler content is rendered.tid="tiddlername"
and field="fieldname"
params (defaults to text
), a unique system-generated timeout/interval ID value will be stored in the specified tiddler field. Then, to cancel an active timeout/interval, you can use <$action-timeout clear={{tiddlername!!fieldname}}/>
.For example:
To click a button and delay 5 seconds before setting a tiddler field, you could write:
\define dosomething() <$action-setfield ... />
<$button> CLICK ME <$action-timeout delay=5000 actions=<<dosomething>>/></$button>
and if you want to have a repeating action once per second that starts immediately upon rendering and automatically stops after 30 seconds, you could write:
\define tick() <$action-setfield $tiddler="ticker" text=<<now "0hh:0mm:0ss">>/>
\define stop(id) <$action-timeout clear={{$id$}}/><$action-deletetiddler $tiddler="$id$"/>
<$action-timeout interval=1000 autostart=yes tid=timerID actions=<<tick>>/>
<$action-timeout delay=30000 autostart=yes actions=<<stop timerID>>/>
{{ticker}} <$list filter="[[timerID]is[tiddler]]" emptyMessage="STOPPED">RUNNING</$list>
enjoy,
-e
Thank you Eric!
This is so neat and useful that it should be part of the core!
Is the delay feature integrated into 5.3 now? I found another thread on a new âoncompletitionâ mode
I am confident it was not because its not documented. However Erics solution should be fine.
Yeah, TiddlyToolsâ delay works great - but if the TIddler is forgotten, its lack produces an ugly widget not defined.
To suppress display of unwanted âUndefined widget âaction-timeoutââ messages when TiddlyTools/Time/action-timeout.js
is missing, you can simply wrap the widget within @@display:none;...@@
. Thus:
@@display:none;<$action-timeout delay="1000" actions=<<myTimeoutActions>>/>@@
Thanks for this hack! But your feature is so important I would like to see it in the core.