At the moment in Server-side JavaScript you can import Java packages using importPackage. I am currently working on a library of JavaScript functions that I wish to use in various scripts. At the moment you have to import the library by adding it to the Form Properties -> Events -> JavaScript Libraries. It would be nice to make the scripts self contained, therefore to be able to import the script directly into the script without involving the form. To date I have never understood the scripts folder in the Library Business Project - maybe it would be a good place to put JavaScript libraries for use in other scripts.
Suggested API:
Code: Select all
importScript([SCRIPT_PROJECT.]SCRIPT_NAME);
e.g.
importScript(LIBRARY.DATE_FUNCTIONS); or
importScript(GLOBAL.PERSON_FUNCTIONS); or
importScript(DATE_FUNCTIONS); assuming that LIBRARY is used as the Default Project.