Project overview
In this chapter, we will build a local storage service. The service will both write to and read from the application's
Local Storage. We will use JS interop to accomplish this. We will use the InvokeVoidAsync
method to write to Local Storage and the InvokeAsync
method to read from Local Storage. Finally, we will create a component to test our service. The test component will both read and write Local Storage. It will use JS interop to display the contents of Local Storage in a JavaScript alert box.
The following screenshot shows both the test component and the application’s Local Storage. When the Save to Local Storage button is clicked the value of the text in the localStorageData
textbox is saved to Local Storage.
When the Read from Local Storage button is clicked, the value of localStorageData
is displayed in a JavaScript alert box. The following screenshot shows a sample of an alert that is displaying...