Skip to content

NodejsPlatform.CreateEnvironment method

Creates a new Node.js environment with a dedicated main thread.

C#
public NodejsEnvironment CreateEnvironment(string? baseDir = null, string? mainScript = null)
parameterdescription
baseDirOptional 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.
mainScriptOptional script to run in the environment. (Literal script content, not a path to a script file.)

Return Value

A new NodejsEnvironment instance.

See Also

Released under the MIT license