JsExportAttribute Class

Generates the JavaScript binding of a class: a source generator adds a static JsClass property to the class, which JsRealm.GetClass turns into a JavaScript class. The class and its containing types must be partial.

[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class JsExportAttribute : Attribute

Remarks

  • The public constructor is the constructor of the JavaScript class (see JsConstructorAttribute when there are several); an abstract class, or a class without public constructor, cannot be created by the scripts.
  • The public instance methods, properties and fields are the methods and accessors of the prototype; the static ones are properties of the constructor.
  • A static class is a plain object whose properties are its static members, as Math.
  • The names are converted to camelCase: use JsNameAttribute to choose another name, and JsIgnoreAttribute to hide a member.
Inheritance
Attribute JsExportAttribute

Constructors

NameDescription
JsExportAttribute()

JsExportAttribute()

public JsExportAttribute()

No documentation is available.

Properties

NameDescription
NameGets or sets the name of the JavaScript class. The default is the name of the .NET class.

Gets or sets the name of the JavaScript class. The default is the name of the .NET class.

public string? Name { get; set; }

Property value

string?