using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.JSInterop; namespace AvaskTest2.Client.Services { public class LocalStorageService : ILocalStorageService { private readonly IJSRuntime jSRuntime; public LocalStorageService(IJSRuntime jSRuntime) => this.jSRuntime = jSRuntime; public async Task DeleteProperty(string propName) { await this.jSRuntime.InvokeVoidAsync("localStorage.deleteItem"); } public async Task GetProperty(string propName) { return await this.jSRuntime.InvokeAsync("localStorage.getItem", propName); } public async Task SetProperty(string propName, T value) => await this.jSRuntime.InvokeAsync("localStorage.setItem", propName, value); public Task GetTabProperty(string propName) { throw new NotImplementedException(); } public Task SetTabProperty(string propName, T value) { throw new NotImplementedException(); } //public async Task WatchAsync(T instance) where T : class //{ // return await this.jSRuntime.InvokeAsync("blazorlocalstorage.watch", DotNetObjectReference.Create(instance)); //} } }