Basic Question about JavaScript

72 views
Skip to first unread message

Chems

unread,
Jun 7, 2019, 2:22:01 AM6/7/19
to TiddlyWiki
Hey,

how do I actually write JavaScripts in Tiddlywiki?
I thought I could just write the code into a tiddler, but it doenst work.
How does the basic structure look like, if for example I want to create a variable, assign a value and finally print that it is visible in the tiddler.

Thanks in advanced!

PMario

unread,
Jun 7, 2019, 3:54:51 AM6/7/19
to TiddlyWiki
Hi,

If you want to define a variable in TW, there are different ways.

3) \define aMacro() : see Macros in wikitext

Variables have a scope. Try this eg:

\define aMacro()
just some text
.
\end

<$set name="var1" value="VAR1">
 
<<var1>> - <<aMacro>><br>
 
<$set name="var1" value="xxx">
   
<<var1>> - <<aMacro>>
 
</$set>
</
$set>

<$vars var-a="asdf" var-b="bbb">
<<var-a>> - <<var-b>>
</$vars>

Have fun!
mario

Mark S.

unread,
Jun 7, 2019, 9:45:55 AM6/7/19
to TiddlyWiki
The two main ways of using are javascript macros, and widgets. The documentation for Widgets is pretty poor/sparse. But javascript macros are easier:

Reply all
Reply to author
Forward
0 new messages