 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
qdnguyen
Joined: 29 Sep 2009 Posts: 10 Country: United States |
|
Help with Javascript |
|
Hi,
I am setting up lots of Javascript jobs and all these jobs are almost the same: read some configurations from a file and use those configurations to make some shell scripts calls. The differences between these jobs are actually what shell scripts to call. So, I do a lot of copy and paste of Javascript code from one job to another. How can I avoid this type of code duplication? Is there a way that we could make a Javascript object to encapsulate all the common code and import and use those objects in the jobs?
Thanks
|
|
Tue Apr 27, 2010 4:51 pm |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
If you want, you can place the common code into a schedule-less job, and just invoke that job from other jobs using Scheduler.runJob(…) or similar method. You can pass the necessary parameters via environment variables, or files. Using files is likely better because the changes are sticky, and can be also seen by multiple jobs and easier to debug.
|
|
Tue Apr 27, 2010 6:31 pm |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|