Skip to content

arivera12/BlazorBrowserStorage

Repository files navigation

BlazorBrowserStorage

HTML5 Storage API for Blazor without any JavaScript Library Dependency.

This package wraps HTML5 Storage APIs.

Both Session and Local storage types are supported.

Installation

Install-Package BlazorBrowserStorage -Version 1.0.0

Register the service in your services method

services.AddBlazorBrowserStorage();

No javascript library reference dependency

This library was ported and improved from BlazorExtensions.Storage but removing any javascript dependency.

Usage

[Inject] ISessionStorage SessionStorage { get; set; } for session storage

[Inject] ILocalStorage LocalStorage { get; set; } for local storage

BlazorBrowserStorage ISessionStorage/ILocalStorage Methods

BlazorBrowserStorage ISessionStorage/ILocalStorage Method
Gets the Length of items in storage Length()
Clears all items in storage Clear()
Gets an item by key of a type from the storage GetItem<T>(string key)
Gets a key name by index from the storage Key()
Remove an item by key from the storage RemoveItem(string key)
Sets an item by key and by item type in the storage SetItem<T>(string key, T item)

License

MIT

About

HTML5 Storage API Implementation for Blazor without any JavaScript Dependency.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published