Forums > Javascript

Possible to include JavaScript file into another?

February 9, 2014 | 8:03 am

Hi,
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?
Cheers!


February 9, 2014 | 11:49 am

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 .


February 10, 2014 | 12:34 am

Thanks for the tip with the Global. Works fine!


Viewing 3 posts - 1 through 3 (of 3 total)