Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make ScriptEngine to run multiple javascript files?

I have 6 js files and I need to include them all into final script to pass ScriptEngine's eval method.How can I do it? ScriptEngine haven't add() method.I can read them with FileReader and than concatenate those strings but I think there will be a better way.

like image 887
shift66 Avatar asked Nov 11 '11 12:11

shift66


2 Answers

You can use the overload eval(Reader) to avoid having to load scripts into a String yourself.

like image 106
millimoose Avatar answered Nov 17 '22 11:11

millimoose


You could use one script to call the other 6 scripts.

Example:

function callOtherFunctions() {
   functionOne();
   functionTwo();
   .
   .
   .
   functionSix();
}

Not 100% sure how good that solution will work but it will call all other 6 functions.

like image 33
Kevin Anthony Oppegaard Rose Avatar answered Nov 17 '22 11:11

Kevin Anthony Oppegaard Rose