This project has moved and is read-only. For the latest updates, please go here.

Reference one compiled script from another

Dec 4, 2014 at 7:45 PM
I have a situation where I want a large static base script included with all the runtime scripts I wish to execute. I don't want to compile this large script with each small script if possible.

Is there any way of referencing one compiled script from another?
Dec 4, 2014 at 7:51 PM
Think I may have found my own answer...If I compile the common script and store it, then execute that compiled script each time before I execute the main script, that should do the trick right? I guess I'll find out soon enough.
Dec 4, 2014 at 10:07 PM
Edited Dec 5, 2014 at 2:32 AM
Hi Eric,

Not sure what you mean by "referencing one script from another". As a script is executed, it may leave functions and/or data hanging off the global object, and subsequent scripts are free to access those artifacts.

Script compilation can provide a significant boost, but remember that a compiled script is bound to the runtime that created it. You can reuse it in other engines within the runtime, but not in other runtimes.

Good luck!
Marked as answer by ericswann on 12/10/2014 at 9:26 AM