JsModuleBinding Class

A binding exported by a module (a ResolvedBinding Record, https://tc39.es/ecma262/#resolvedbinding-record): a binding of the environment of JsModuleBinding.Module, or its namespace object. Returned by JsHostDefinedModule.GetImport.

public sealed class JsModuleBinding

Properties

NameDescription
BindingNameGets the name of the binding in the environment of JsModuleBinding.Module, or null when the binding is the namespace object of the module.
IsNamespaceGets whether the binding is a namespace object (export * as ns from).
ModuleGets the module whose environment holds the binding (the module that declares it, after the re-exports).

Gets the name of the binding in the environment of JsModuleBinding.Module, or null when the binding is the namespace object of the module.

public string? BindingName { get; }

Property value

string?

Gets whether the binding is a namespace object (export * as ns from).

public bool IsNamespace { get; }

Property value

bool

Gets the module whose environment holds the binding (the module that declares it, after the re-exports).

public JsModule Module { get; }

Property value

JsModule

Methods

NameDescription
GetValue()Reads the value of the binding (GetBindingValue).
TryGetValue(JsValue)Reads the value of the binding (GetBindingValue). Returns false when the binding is not initialized yet (e.g. a let or a const of a module that is not evaluated, the temporal dead zone).

Reads the value of the binding (GetBindingValue).

public JsValue GetValue()

Returns

JsValue

Exceptions

JsException
The binding is not initialized (a ReferenceError).

TryGetValue(JsValue)

JsModuleBinding.cs

Reads the value of the binding (GetBindingValue). Returns false when the binding is not initialized yet (e.g. a let or a const of a module that is not evaluated, the temporal dead zone).

public bool TryGetValue(out JsValue value)

Parameters

value JsValue

Returns

bool