-
Book Overview & Buying
-
Table Of Contents
Blazor WebAssembly by Example - Third Edition
By :
You have created a Local Storage Service by using JS interop to invoke JavaScript functions from your Blazor WebAssembly application.
In this chapter, you learned why JavaScript remains essential and how to use the IJSRuntime abstraction to invoke JavaScript functions from .NET, both asynchronously and synchronously. You also learned how to invoke .NET methods from JavaScript functions. Finally, you learned how to persist data in the browser's localStorage.
You used the Blazor WebAssembly Standalone App project template to create the Local Storage Service. You added a couple of JavaScript functions to read and write the browser's localStorage. Then, you added a class to invoke those JavaScript functions. In the last part of the chapter, you tested your Local Storage Service by adding a collocated JavaScript file that displayed data in a JavaScript alert box.
One of the biggest benefits of using Blazor WebAssembly is that all the code runs entirely in the browser. This...