On Sunday, July 19, 2020 at 2:25:58 AM UTC-7, PMario wrote:
>
> On Sunday, July 19, 2020 at 7:39:34 AM UTC+2, Eric Shulman wrote:
>>
>> However... I've also added another param, autostart="yes", which will 
>> actually trigger the $action-timeout as soon as it is rendered, even if 
>> it's not inside a $button.
>> I'm not sure when this param will be useful, and it's best to consider it 
>> "experimental" for now.
>>
>  

> @Eric. ... I personally would create 2 plugins. 1 with the "useful" 
> timeout and 1 with the potentially dangerous "experimental" parameter. 
>

As long as you don't specify the autostart="true" param, it just does the 
"useful" timeout when triggered from a user-action (button press).
Note that even without using autostart, you can still create "tail end" 
timer loops that can then be controlled by setting a flag field.

For example, here's how I implemented the timer's "elapsed time" display:

\define ticker_actions()
<$action-timeout delay="1000" id="$(currentTiddler)$" actions="""
   <$list filter="[[$(currentTiddler)$]is[tiddler]]">
      <$action-setfield $timestamp="no" now=<<now YYYY0MM0DD0hh0mm0ss0XXX>> 
/>
      <$reveal default={{!!stop}} type="match" text="">
         <$importvariables filter="TiddlyTools/Timer"> <<ticker_actions>> 
</$importvariables>
      </$reveal>
   </$list>
""" />
\end

Note how the timeout widget invokes an action that sets the "now" field (to 
track the current time...
used to calculate the elapsed time) and then it checks if the "stop" field 
is blank.  If it is, then it
schedules another timeout to occur in one second.  This function will keep 
invoking itself once
a second until "stop" is set to a non-blank value (i.e., "true"), which is 
triggered by the user 
when they explicitly press the "stop" button in the timer interface.

-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/c8432b4c-2c14-4cd0-9184-9984713f6c22o%40googlegroups.com.

Reply via email to