A class for holding precompiled scripts, and running them in specific sandboxes.
Constructor
new(code:String, ?options:Null<ScriptOptions>)
Methods
runInContext(contextifiedSandbox:VmContext<Dynamic>, ?options:Null<ScriptRunOptions>):Dynamic
Similar to Vm.runInContext
but a method of a precompiled Script
object.
runInContext
runs script's compiled code in contextifiedSandbox
and returns the result.
Running code does not have access to local scope.
runInNewContext(?sandbox:{}):Dynamic
runInNewContext(sandbox:{}, ?options:Null<ScriptRunOptions>):Dynamic
Similar to Vm.runInNewContext
but a method of a precompiled Script
object.
runInNewContext
contextifies sandbox if passed or creates a new contextified sandbox if it's omitted,
and then runs script's compiled code with the sandbox as the global object and returns the result.
Running code does not have access to local scope.
runInThisContext(?options:Null<ScriptRunOptions>):Dynamic
Similar to Vm.runInThisContext
but a method of a precompiled Script
object.
runInThisContext
runs the code of script and returns the result.
Running code does not have access to local scope, but does have access to the current global object.