Hi bimlas
Apologies, I should have pointed out that $tw.node having the value {} does
evaluate to true, as expected.
Best wishes
Jeremy
> On 11 Jul 2019, at 10:54, Jeremy Ruston <[email protected]> wrote:
>
> Hi bimlas
>
> $tw.boot.boot() is an async function, and takes a callback. TW won’t be fully
> initialised until it gets to the callback. So try something like:
>
> var $tw = require("./boot/boot.js").TiddlyWiki();
>
> $tw.boot.argv = ['myproject', '--listen'];
>
> $tw.boot.boot(function() {
> console.log($tw.node);
> console.log($tw.wiki.getTiddlerText('$:/info/node'));
> });
>
> Best wishes
>
> Jeremy
>
>> On 11 Jul 2019, at 10:52, bimlas <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> To be clear: I need Node because I want to use NPM modules.
>>
>> 2019. július 11., csütörtök 11:34:31 UTC+2 időpontban bimlas a következőt
>> írta:
>> Dear all,
>>
>> In a Node.js Javascript project, I want to use TiddlyWiki to display data.
>>
>> To run Node methods, I need to create modules with "module-type: utils-node"
>> (if I understand it well), thus I can reach them through $tw.utils. These
>> will only be loaded by TiddlyWiki if $:/info/node is "yes" (so the value of
>> $tw.node is not null). I have several Node wiki, checked in each (in the
>> browser), but it seems that nowhere does it detects that the wiki is running
>> under Node, because viewing $:/info/node in the browser says "no".
>>
>> I'm confused, because if I check in the code, it detects that it is running
>> under Node.
>>
>> $tw.boot.argv = ['myproject', '--listen'];
>> $tw.boot.boot();
>>
>>
>> console.log($tw.node);
>> // {}
>> console.log($tw.wiki.getTiddlerText('$:/info/node'));
>> // yes
>>
>> If I create a widget that uses this Node module, it doesn't work in the
>> browser, instead of the widget, RSOD appears: $tw.utils.myNodeFunction is
>> not a function
>>
>> My question is how can I use the Node module in the browser?
>>
>> --
>> 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/3e0d6bc9-86c3-443c-8146-81acc7c98809%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/tiddlywikidev/3e0d6bc9-86c3-443c-8146-81acc7c98809%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/84606DC0-4971-4E5D-95E8-113B179CC710%40gmail.com.
For more options, visit https://groups.google.com/d/optout.