Page 1 of 1
How to include external scripts
Posted: Thu Feb 14, 2013 6:54 pm
by alexbevi
In a lot of scripts that require interacting with external systems, I'm forced to hardcode URLs, connection information, usernames, passwords ... etc.
Is there a way to maintain a single script that can be included in other scripts?
This way if I need to update a constant, I do it once and know it will be used properly?
I'm basically wondering if Switch provides something along the lines of
http://requirejs.org
How to include external scripts
Posted: Thu Feb 14, 2013 7:11 pm
by alexbevi
In case any Enfocus developers read this, there's an interesting article at
https://github.com/amdjs/amdjs-api/wiki/AMD that may help facilitate this (and similar) requests in the future.
How to include external scripts
Posted: Fri Feb 15, 2013 3:14 pm
by freddyp
Not that you have to convince me of how nice it would be to have a sort of include/define capability, but as we do not have it right now, let me suggest the following alternative.
In Switch you can maintain global data which is accessible to all flows. Look at the documentation of the Environment class. It is really easy to make a flow with just one script in it that sets the global data. And in all your scripts you get the global data. When there is a change of parameters you edit the one script, run the flow and all your scripts will access the new values of the global data.
Freddy
How to include external scripts
Posted: Tue Feb 19, 2013 3:38 pm
by alexbevi
Thanks for the feedback Freddy.
I've been using the global data approach to accomplish the equivalent of 'Environment Variables', but what I really want is an attachable source file that would allow for common script functions to be defined.