NodejsPlatform.CreateEnvironment method
Creates a new Node.js environment with a dedicated main thread.
C#
public NodejsEnvironment CreateEnvironment(string? baseDir = null, string? mainScript = null)
parameter | description |
---|---|
baseDir | Optional directory that is used as the base directory when resolving imported modules, and also as the value of the global __dirname property. If unspecified, importing modules is not enabled and __dirname is undefined. |
mainScript | Optional script to run in the environment. (Literal script content, not a path to a script file.) |
Return Value
A new NodejsEnvironment
instance.
See Also
- class NodejsEnvironment
- class NodejsPlatform
- namespace Microsoft.JavaScript.NodeApi.Runtime