[twdev] Re: require("...") in a js macro ?

2018-07-21 Thread FrD
Hi PMario,

Most of the time I prefer to define a function this way (in particular for 
a library) :

var myUtilFunction = function(a,b,c, ..) {
}

Regards

FrD

Le samedi 21 juillet 2018 10:46:14 UTC+2, PMario a écrit :
>
> On Friday, July 20, 2018 at 10:32:07 PM UTC+2, FrD wrote:
>>
>>
>> So I've put this part in a function (say : myUtilFunction) in another 
>> tiddler (say : Utils.js, application/javascript, and module-type : 
>> library). At the end : exports.myUtilFunction = myUtilFunction;
>>
>
> Did you define myUtliFunctin like this? 
>
> function myUtilFunction(a, b, c, ..) {
> }
>
> -m
>

-- 
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 tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
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/5b3ded8a-e134-4083-bf15-b13a72278de9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[twdev] Re: require("...") in a js macro ?

2018-07-21 Thread PMario
On Friday, July 20, 2018 at 10:32:07 PM UTC+2, FrD wrote:
>
>
> So I've put this part in a function (say : myUtilFunction) in another 
> tiddler (say : Utils.js, application/javascript, and module-type : 
> library). At the end : exports.myUtilFunction = myUtilFunction;
>

Did you define myUtliFunctin like this? 

function myUtilFunction(a, b, c, ..) {
}

-m

-- 
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 tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
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/a53e2c09-898e-4d5e-8438-c3de54fe4d89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[twdev] Re: require("...") in a js macro ?

2018-07-21 Thread FrD
Hi,

Sorry, I found a typo in my Utils.js tiddler : I wrote export. ... instead 
of export*s*. ...
My bad.

Everything's fine now.

Regards

FrD

Le vendredi 20 juillet 2018 22:32:07 UTC+2, FrD a écrit :
>
> Hi,
>
> I've written two js macros, and part of the code is the same.
>
> So I've put this part in a function (say : myUtilFunction) in another 
> tiddler (say : Utils.js, application/javascript, and module-type : 
> library). At the end : exports.myUtilFunction = myUtilFunction;
>
> Now I'm trying to make this function available int the two macros.
> So in the twos macros, before "exports.name = ...", I have :
>
> var myUtilFunction = require("Utils.js").myUtilFunction;
>
> It doesn't work, the error message reads : myUtilFunction is not a 
> function.
>
> I've already used this way in writing a widget and it worked. Is there a 
> pb with macros ?
>
>
> Any help welcome !
>
> Regards
>
> FrD
>
>

-- 
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 tiddlywikidev+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywikidev@googlegroups.com.
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/be6094c7-d4f9-48fc-9cc2-5278e0f4d637%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.