Hi Joe

Chris Hunt did a nice walkthrough a few years ago:

http://cjhunt.github.io/

Bonus - it’s made with v5.0.7, which now seems ancient. But not much has 
changed since then, so I’d expect the material to still work.

Alternatively, you could read through some of the core widgets in reverse order 
of complexity.

https://github.com/Jermolene/TiddlyWiki5/tree/master/core/modules/widgets

The “text" widget is a good place to start; it just renders a string of text 
provided as an attribute:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/text.js

The “codeblock” is marginally more complex: it renders a <code>/<pre> pair to 
contain it’s rendered children:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/codeblock.js

The “vars” widget introduces variable assignments:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/vars.js

The “count” widget is a good example of a simple widget with a slightly more 
complicated refresh strategy: it only refreshes itself if the count has changed:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/count.js

Finally, the “keyboard” widget is a simple example of a widget with an event 
handler:

https://github.com/Jermolene/TiddlyWiki5/blob/master/core/modules/widgets/keyboard.js

Best wishes

Jeremy


> On 21 Dec 2018, at 09:07, joearms <[email protected]> wrote:
> 
> Has anybody written a "How to write a widget" guide?
> 
> I'm looking for a guide that starts with the simplest possible
> widget (zero args) and explains in gruesome detail exactly what
> each line of code does.
> 
> Following this I'd like to see how arguments get added ..
> 
> Any suggestions?
> 
> Cheers
> /Joe
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TiddlyWikiDev" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/tiddlywikidev 
> <https://groups.google.com/group/tiddlywikidev>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywikidev/c4ac4aaa-18bb-4581-9e4a-2752bd5482bf%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywikidev/c4ac4aaa-18bb-4581-9e4a-2752bd5482bf%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" 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 https://groups.google.com/group/tiddlywikidev.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/347F032E-9F59-4DCC-BD18-1D06F13CFD46%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to