Loads a local JavaScript file to your app to make its functionality available in your app.
By default it is loaded just before OnStart is being called unless you set “NoDefer” to true which forces inline loading.
This is to ensure errors are highlighted correctly in external source files.
See Also: LoadScript
Example - Deferred Loading (recommended)
app.WriteFile( "script.js", "var num = 7;\nfunction computeNum() { return 6 * num; }" );
app.Script( "script.js" );
function OnStart() {
app.ShowPopup( "script.js loaded." );
app.Alert( computeNum(), "computed number: " );
}
Example - Inline Loading
app.WriteFile( "script.js", "var num = 7;\nfunction computeNum() { return 6 * num; }" );
function OnStart() {
app.Script( "script.js", true );
app.ShowPopup( "script.js loaded." );
app.Alert( computeNum(), "computed number: " );
}