On Saturday, September 12, 2020 at 7:04:59 AM UTC-7, Zhe Lee wrote:
>
> Here is the thing, I use a template to add a button to every tiddler. The
> thing is I don't use the button that much but still use it sometimes.
> I want to know is the EditTemplate tag like this will eat a lot of
> resource of computer and finally slow down the responding of the
> TiddlyWiki? Should I delete the template tiddler if I don't use the
> template that much?
>
It doesn't take a lot of overhead to render the $button, even if it added
to every tiddler. This is especially true since it is added to the
EditTemplate, as there is usually only one tiddler (or perhaps a few
tiddlers) being edited at any given moment.
Even so, there is a way you can reduce the overhead even further by using
the $button actions="..." parameter, like this:
\define doCreate()
<$action-sendmessage $message="tm-new-tiddler" title="This is newly created
tiddler" tags={{!!tags}} text=<<now "Today is DDth, MMM YYYY">> />
\end
<$button actions=<<doCreate>>>Copy Current Tags and Create</$button>
When you use this syntax, the doCreate() macro is only processed when the
$button is actually pressed.
Note that this also causes the <<now>> macro used to generate the new
tiddler's text to only be invoked when the $button is pressed. This
produces a subtle but somewhat important difference in the resulting
tiddler's content.
For example, if you were to start editing a tiddler just before midnight,
but not press the button until after midnight, the date written into the
tiddler text will accurately record when the $button is pressed, not when
it was initially rendered.
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/241e392e-7c52-4388-9384-41c6c4dcc2cao%40googlegroups.com.