Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Using Compile with Execute and Script

$
0
0
I have an application (with V8ClearScript) where the user occasionally loads a collection of script libraries. They then develop a Main script that can call those library scripts. The Main script will execute on a timer that may scan anywhere from once every 1 second to once every 10 seconds - most likely closer to 1 second.

It sounds like my best bet is to precompile the scripts. Generally the user may reload everything if they make changes to the library scripts. The user may just reload the main script if they make changes to just the main script. The user then can put the main script on scan or take it off scan before reloading.

Do first compile the script then execute the script?
ThisScript = Engine.Compile(scriptFile)
Engine.Execute(ThisScript)
When the timer is on I use the Script method to call a specific function name in the main script. The user understands that if they want to run a script every scan it must be in the main script and a function named Main() must exist in that script.

Viewing all articles
Browse latest Browse all 2297

Trending Articles