Side effects of executing $tw.wiki.defineTiddlerModules twice?

31 views
Skip to first unread message

Danielo Rodríguez

unread,
Sep 1, 2016, 7:46:30 PM9/1/16
to TiddlyWikiDev
Hello,

I have a startup module that should register some module types. It runs before the startup module load-modules, so what it does is:

  • Loads the required tiddlers
  • Add those tiddlers to the store
  • calls $tw.wiki.defineTiddlerModules() to register those modules
  • Lets load-modules do its work
I was wondering if there is any ugly side effect because executing $tw.wiki.defineTiddlerModules() twice, once on boot and another after my startup module has been executed.
Taking a look at the function seems that it takes care of not registering plugins twice, but I'm not sure if something escapes to my eyes.

Regards.

Danielo Rodríguez

unread,
Sep 4, 2016, 10:39:22 AM9/4/16
to TiddlyWikiDev
No one has an idea? I don't require a very detailed reasoning, just briefly if it fine or not

Tobias Beer

unread,
Sep 5, 2016, 3:39:03 PM9/5/16
to TiddlyWikiDev
Hi Danielo,

From what I would guess, you could call $tw.modules.define directly, but I don't know it that requires any post-processing for what you're eventually trying to achieve.

By the looks of it, calling $tw.wiki.defineTiddlerModules should be fine too, at least it appears to avoid throwing a bunch of "Warning: Redefined module..." console logs. However, it will re-process all dictionaries and json tiddlers, which at least seems quite unnecessary.

Best wishes,

Tobias.

BJ

unread,
Sep 5, 2016, 4:59:31 PM9/5/16
to TiddlyWikiDev
Hi Danielo,
tiddlywiki constructs some of its software by synthesis in the startup modules (by $tw.modules.forEachModuleOfType() for instance) so in general, what you are suggesting will not work as modules need to be added before start modules are run.

all the best
BJ

Danielo Rodríguez

unread,
Sep 5, 2016, 5:47:59 PM9/5/16
to TiddlyWikiDev
Hello BJ,

In which modules are you thinking?
Javascript modules are working fine. Probably they are not the best example because they are not a key part of TW functionality. Could you suggest a better approach?

Reply all
Reply to author
Forward
0 new messages