VM
Node.js vm module — JavaScript code compilation and execution.
Module: node:vm
Support: Experimental
Since: 1.1.0
Docs: Node.js Docs
Static Methods
🟢 createContext(sandbox)
Creates a new execution context (sandbox).
🟢 runInNewContext(code, sandbox, options)
Runs the compiled code within a new context created from the given sandbox.
🟢 runInThisContext(code, options)
Runs the compiled code within the context of the current global object.
🟢 isContext(sandbox)
Returns whether the given object is a contextified sandbox.
Interface Script
A precompiled script that can be executed in various contexts.
Since: 1.1.0
Docs: Node.js Docs
Methods
🟢 runInThisContext(options)
Runs the compiled code within the context of the current global object.
🟢 runInNewContext(sandbox, options)
Runs the compiled code within a new context created from the given sandbox.
---