Possible to include JavaScript file into another?

Feb 9, 2014 at 8:03am

Possible to include JavaScript file into another?

I would like to put some JavaScript functions I use often in a separate file to prevent copy/paste. Is it somehow possible to include a JavaScript file into another? Or is there a workaround?

Feb 9, 2014 at 11:49am

Hi !

well . you can include js content by putting your Utils into Cycling ’74/jsextensions/ folder .
This way your functions are seen within every JS project used in max .
Personally i would love to have #include directive as an option and be specific to the current project, but thats not possible without writing a compiler for JS (someone did) ,
every changes require recompiling .

There is third option . Pack your utils into Global object inside one JS instance and access it in another .

mostly im using the last one .

Feb 10, 2014 at 12:34am

Thanks for the tip with the Global. Works fine!


You must be logged in to reply to this topic.