0 votes

Hi guys,

sometime in serverscripts you can wish to organize your code over several serverscripts like a tools.js library by example.

in almost cases you can just do the trick from your serverscripts call like :

<%LoadScript("mylib1.js;mylib2.js;myscriptfile.js")%> 

same goes for ajax calls.

this does not correspond to a real include from a file so we can't just use this trick for scheduler.exe.

I found a way to make an include like call from a serverscript that works in scheduler as well so please enjoy it (even if the solution is a bit obvious I never thought about that before so...)

var root = "C:/inetpub/wwwroot/customs/mycustom/";
var dependencies = [
    "serverscripts/mylib1.js",
    "serverscripts/mylib2.js"
];

for (var i=0; i<dependencies.length; i++){
    eval(StrLoadBinaryFile(root + dependencies[i]));
}

function myFunction(){ //-----(called by the scheduler)
    return functionFromMyLib1(); //-----(definition in mylib1.js)
}

since I havn't tested it in a workflow I can only assume that it would do the trick as well.

Best regards,

asked in Efficy/ Client side by (989 points)
If I put the command 'StrLoadBinaryFile' outside the function, I get the error message 'Fonction attendue'.
If i put the command 'StrLoadBinaryFile'  in the function 'myFunction', It works.
How to use the command 'StrLoadBinaryFile' outside of functions?
Thank's
Hi, what is your context of use of this? scheduler, ajax, serverscripts?
in my use cases it works from outside the function.
serverscripts

1 Answer

+1 vote

Well, this is indeed a nice approach for all Efficy versions so far.

Good news is that Efficy 11 will support loading serverside modules and also it will use a recent version of Javascript (ECMA). Stay tuned.

answered by (7.4k points)
do you have any date or estimation for the release?
thanks
I don't expect a well tested version this year, I assume somewhere beginning of 2018
I am so excited about that^^ I love the direction that R&D is giving to customization engine.
(please make some proper documentation^^)
1,249 questions
1,519 answers
1,859 comments
328 users