- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 12:54 AM
※Paris version
I'm aiming for script concurrency using "Schedule Once".
I understand how to use it as follows,
I don't understand how it works.
function script(argument){
//ScheduleJob
gs.info(argument);
}
var argument ="Test OK"
var sched = new ScheduleOnce();
sched.script = '('+script+')("'+argument+'");';
sched.schedule();
I wondered if "script" should be a string in the "'(' + script +')" part, but why specify the function name?
I'm learning a script so please let me know.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 03:21 AM
Re-read the original question.
No, "script" should not be a string. It's a function.
For example, following code will call the function named "script" immediately.
function script(argument){
//ScheduleJob
gs.info(argument);
}
var argument ="Test OK"
(script)(argument);
As such, in sched.script, it's necessary to pass the function named "script" (i.e. the content of the function) and not the entire definition of the function including "function script(argument)) {".
sched.script = '('+script+')("'+argument+'");';
That is,
sched.script = 'gs.info("test ok");';
and not this,
sched.script = 'function script(){gs.info("test ok");}';

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2022 02:24 AM
Hi,
In your example "'(' + script +')" refers the function named script defined in first line. You should add all your code inside this function. If you change the name of this function then the same name to be used in this line you mentioned
Thank you,
Palani
Palani