Hi Roma

Sorry for the late reply.

wiki.addTiddler() is the fundamental way to update a tiddler.

wiki.setTextReference() is a slightly higher level function: rather than
working with a tiddler title it understands a text reference (
http://tiddlywiki.com/#TextReference) - for example, the text reference
"HelloThere!!myfield" specifies the field "myfield" on the tiddler
"HelloThere". Thus, you can't use setTextReference() to reference a tiddler
that contains "!!" or "##".

Generally, you should use addTiddler() unless you specifically need to
support text references as part of the syntax of your widget.

Best wishes

Jeremy



On Mon, Aug 18, 2014 at 10:42 PM, Roma Hicks <[email protected]> wrote:

> I am in the process of creating a suite of widget for a plugin I am
> developing.  I have been using some of the existing widget code an a
> template and extending functionality, but in the process of doing so I have
> noticed some coding differences in the methods to update tiddlers.
>
> In particular some widgets use:
> this.wiki.setText(/*...fields...*/);
>
> And in others:
> this.wiki.addTiddler(new $tw.Tiddler(/*...fields...*/));
>
> While I have coarse understanding of tiddler functions, the underlying
> differences seem to be: one sets fields explicitly, the other more
> implicitly.  Is there a stylistic preference for one over the other when
> editing one field?  Is there a performance or stability reason to prefer
> one?
>
> Thanks.
>
> --
> 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 post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/tiddlywiki.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Jeremy Ruston
mailto:[email protected]

-- 
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to