Package-level declarations
Types
This feature is only available with the --experimental-vm-modules
command flag enabled.
This feature is only available with the --experimental-vm-modules
command flag enabled.
Functions
Compiles the given code into the provided context (if no context is supplied, the current context is used), and returns it wrapped inside a function with the given params
.
If the given contextObject
is an object, the vm.createContext()
method will prepare that object and return a reference to it so that it can be used in calls to {@link runInContext} or script.runInContext()
. Inside such scripts, the global object will be wrapped by the contextObject
, retaining all of its existing properties but also having the built-in objects and functions any standard global object has. Outside of scripts run by the vm module, global variables will remain unchanged.
Measure the memory known to V8 and used by all contexts known to the current V8 isolate, or the main context.
The vm.runInContext()
method compiles code
, runs it within the context of the contextifiedObject
, then returns the result. Running code does not have access to the local scope. The contextifiedObject
object must have been previously contextified
using the {@link createContext} method.
This method is a shortcut to (new vm.Script(code, options)).runInContext(vm.createContext(options), options)
. If options
is a string, then it specifies the filename.
vm.runInThisContext()
compiles code
, runs it within the context of the current global
and returns the result. Running code does not have access to local scope, but does have access to the current global
object.