Options for calling functions between multiple instances of [js]

Jul 18, 2013 at 11:00pm

Options for calling functions between multiple instances of [js]

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.

#256431
Jul 20, 2013 at 12:58pm

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…

#256587
Jul 20, 2013 at 1:14pm

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

-A

#256588
Jul 21, 2013 at 7:59am

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).

#256640
Jul 23, 2013 at 3:30pm

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.

#256968

You must be logged in to reply to this topic.