-
Book Overview & Buying
-
Table Of Contents
Web Development with Blazor - Fourth Edition
By :
With Blazor WebAssembly, we have direct access to the JSRuntime (since all the code is running inside the browser). Direct access will give us a really big performance boost. For most applications, we are doing one or two JavaScript calls. Performance is not really going to be a problem. Some applications are more JavaScript-heavy, though, and would benefit from using the JSRuntime directly.
We have had direct access to JSRuntime using IJSInProcessRuntime and IJSUnmarshalledRuntime. But after .NET 7, both became obsolete, and we have gotten a nicer syntax.
In the GitHub repository, I have added a project called BlazorWebAssemblyStandaloneApp, with a couple of files if you want to try the code.
We will start by looking at calling JavaScript from .NET. These samples must run in a WebAssembly-only project. They are included in the source on GitHub for reference.
To be able to use these features, we need to enable them in the project file by enabling AllowUnsafeBlocks...