Forums > Javascript

Options for calling functions between multiple instances of [js]

Jul 18 2013 | 11:00 pm

I’m working on a project that involves multiple instances of [js] that I’d like to share functions between. I’ve learned that dropping my .js files into the jsextensions folder will accommodate the behavior I’m looking for but this approach also makes things messy in that I’d like to keep all the files for the project in one location in the cloud.

Is there a better way of doing this that doesn’t fragment my project across multiple locations?

Thanks in advance.

Jul 20 2013 | 12:58 pm

I’ve explored several options for this, in the end I went with a homegrown include mechanism – I run all my Javascript through a little program a wrote that looks for "include …" strings and then physically inserts the file into the output stream… thus, everything needed always ends up in one file..

You can always put stuff in a Global aswell, but performance will be slightly hit…

Jul 20 2013 | 1:14 pm

jsextensions may be placed in the packages folder in 6.13 or greater, this should make things a lot easier to manage.


Jul 21 2013 | 7:59 am

Thanks very much to the both of you. I’m going to experiment with both and see which is more performant (there are a lot of functions).

Jul 23 2013 | 3:30 pm

Hi, it might not be so useful with the new Max6 feature that Andrew mentioned but I wrote some javascript for eval()-ing external code into projects for re-use. You can find it , I hope it’s something you find helpful.

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

Forums > Javascript