What is the significance of "/*global $tw: false*/"?

42 views
Skip to first unread message

Ben H.

unread,
Aug 26, 2015, 6:08:37 PM8/26/15
to TiddlyWiki
I see this everywhere in the source code, and I can't figure out what it means. I'm confused because it is in a comment, so it isn't executable javascript code... What is it for?

Jeremy Ruston

unread,
Aug 26, 2015, 6:32:03 PM8/26/15
to TiddlyWiki
Hi Ben

It's a pragma for configuring JSHint and compatible code checking tools. It tells JSHint not to treat $tw as an undefined variable (it is defined in all TiddlyWiki code modules courtesy of the module loader in boot.js). See the "Directives" section here:


At a quick glance, I notice that the docs have "globals" instead of "global"; I believe that TW5 is using an older but still supported keyword.

Best wishes

Jeremy.



On Wed, Aug 26, 2015 at 11:08 PM, Ben H. <moog...@gmail.com> wrote:
I see this everywhere in the source code, and I can't figure out what it means. I'm confused because it is in a comment, so it isn't executable javascript code... What is it for?

--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/52767644-acbd-48f8-945a-cfbca7eab530%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Jeremy Ruston
mailto:jeremy...@gmail.com

Ben H.

unread,
Aug 26, 2015, 6:34:52 PM8/26/15
to TiddlyWiki
Perfect, thanks for the quick reply!
Reply all
Reply to author
Forward
0 new messages