Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSExportAttribute improvements #272

Merged
merged 2 commits into from
Apr 11, 2024
Merged

JSExportAttribute improvements #272

merged 2 commits into from
Apr 11, 2024

Conversation

jasongin
Copy link
Member

Fixes: #269

This adds capabilities to JSExportAttribute to export all types from an assembly or exclude specific types or members from exporting:

[assembly: JSExport] // Export all public types in the current assembly (unless otherwise specified).

// This type is not exported: the type-level attribute overrides the assembly-level attribute.
[JSExport(false)]
public static class NonExportedClass
{
    // This method is exported as a static method on the module (not on the class).
    // The member-level attribute overrides any class or assembly-level attributes.
    [JSExport]
    public static void ModuleMethod();
}

// Without a type-level attribute, public types are exported due to the assembly-level attribute.
public class ExportedClass
{
    // The member-level attribute overrides any class or assembly-level attributes.
    [JSExport(false)]
    public void NonExportedMethod() {}

    // Without a member-level attribute, public members are exported along with the type.
    public void ExportedMethod() {}
}

@jasongin jasongin merged commit ddab462 into main Apr 11, 2024
14 checks passed
@jasongin jasongin deleted the dev/jasongin/jsexport branch April 11, 2024 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Mark whole assembly with JSExport
2 participants