A library for Blazor local and session storage support.
Clone or download
Latest commit 63d1cf2 Jul 23, 2018

README.md

Blazor Local and Session Storage Support

Installation

PM> Install-Package Cloudcrate.AspNetCore.Blazor.Browser.Storage

See it in Action

Check out Steve Sanderson's demo at NDC Minnesota, at minute 48

Usage

Add Services to Dependency Injection

var serviceProvider = new BrowserServiceProvider(services =>
{
    services.AddStorage();
});

Inject and use Storage

@using Cloudcrate.AspNetCore.Blazor.Browser.Storage;
@inject LocalStorage Storage

<input type="text" bind="@value" />
<button onclick="@SetValue">Set</button>
<button onclick="@GetValue">Get</button>


@functions
{
    string value;

    void SetValue()
    {
        Storage["Value"] = value;
    }

    void GetValue()
    {
        value = Storage["Value"];
    }
}