2 ms·
This is a minor corner of .NET 5 but I'm bummed that .NET's Blazor (WebAssembly) has no way to interact with the HTML Canvas from C#, so you have to write JS in
by simonsarris 6y ago
This is a minor corner of .NET 5 but I'm bummed that .NET's Blazor (WebAssembly) has no way to interact with the HTML Canvas from C#, so you have to write JS interop code, so its quite slow (that is, C# WebAssembly with Canvas is slower than just writing JS).
My hope was that by the time .NET 5 was out of preview, we would have seen something for this so people could write C# for Canvas in WebAssembly. Alas, not yet!
- sunshinerag 6y agoIsn't that a limitation of wasm?
- torginus 6y agoThat's not quite true, there's this project, that already has the boilerplate written for you: https://github.com/BlazorExtensions/Canvas https://github.com/BlazorExtensions/Canvas It supports both Canvas2D and WebGL. The API supports batching calls across the interop barrier, so that the interop performance costs are minimized. As for Blazor being slow: please correct me if I'm wrong, but my understanding, that Blazor code is interpreted, because JIT compilation in wasm is not really possible. The implementation of AoT compilation, which will fix the perf issues is coming along, but it's not quite there yet.