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

Types Inheriting from IJSWrapper should have [IJSWrapperConverter] attribute. #8

Open
KristofferStrube opened this issue Jul 4, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@KristofferStrube
Copy link
Owner

KristofferStrube commented Jul 4, 2024

Adding the IJSWrapperConverter attribute from Blazor.WebIDL to types that implement or inherit from IJSWrapper would make JSInterop with the types defined in this library easier.

This would make it so that you can do this:

MediaStream mediaStream = ... // some mediastream;

await JSRuntime.InvokeVoidAsync("methodTakingMediaStream", mediaStream);

instead of:

MediaStream mediaStream = ... // some mediastream;

await JSRuntime.InvokeVoidAsync("methodTakingMediaStream", mediaStream.JSReference);

This problem only gets worse when we have option types that hold wrapper types like the MediaStreamAudioSorceOptions type from Blazor.WebAudio.

Eventually I would like an analyzer that makes an error in the build if you have forgotten to add the IJSWrapperConverter attribute to some class.

@KristofferStrube KristofferStrube added enhancement New feature or request good first issue Good for newcomers labels Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant