ShadyNagy.Blazor.JavaScriptUtilities 1.0.7

Blazor JavaScript Utilities.

There is a newer version of this package available.
See the version list below for details.
Install-Package ShadyNagy.Blazor.JavaScriptUtilities -Version 1.0.7
dotnet add package ShadyNagy.Blazor.JavaScriptUtilities --version 1.0.7
<PackageReference Include="ShadyNagy.Blazor.JavaScriptUtilities" Version="1.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ShadyNagy.Blazor.JavaScriptUtilities --version 1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ShadyNagy.Blazor.JavaScriptUtilities, 1.0.7"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ShadyNagy.Blazor.JavaScriptUtilities as a Cake Addin
#addin nuget:?package=ShadyNagy.Blazor.JavaScriptUtilities&version=1.0.7

// Install ShadyNagy.Blazor.JavaScriptUtilities as a Cake Tool
#tool nuget:?package=ShadyNagy.Blazor.JavaScriptUtilities&version=1.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Blazor.JavaScriptUtilities

Utilities by JavaScript for Blazor

  • Local Storage Available to check if available in browser

  • Local Storage Set

  • Local Storage Read

  • Local Storage Remove by key

  • Local Storage Read All without keys

  • Local Storage Remove All

  • Local Storage Count

  • Local Storage Listener for changes

  • Session Storage Available to check if available in browser

  • Session Storage Set

  • Session Storage Read

  • Session Storage Remove by key

  • Session Storage Read All without keys

  • Session Storage Remove All

  • Session Storage Count

  • Session Storage Listener for changes

  • Scroll Hide

  • Scroll Show

  • Cookie Read

  • Cookie Delete

...... and more coming.

Local Storage
scrollbar-controller

Give a Star!

If you like or are using this project please give it a star. Thanks!

Getting Setup

You can install the package via the nuget package manager just search for ShadyNagy.Blazor.. You can also install via powershell using the following command.

Install-Package ShadyNagy.Blazor.JavaScriptUtilities

Or via the dotnet CLI.

dotnet add package ShadyNagy.Blazor.JavaScriptUtilities

1. Register Services

For Blazor WebAssembly: You will need to add the following using statement and add a call to register the Blazor JavaScript Utilities services in your applications Program.Main method.

using ShadyNagy.Blazor.JavaScriptUtilities;

public static async Task Main(string[] args)
{
    builder.Services.AddAllBlazorJavaScriptUtilities();
}

Also you can register what you need only ex

builder.Services.AddBlazorScrollController();

For Blazor Server: You will need to add the following using statement and add a call to register the Blazor JavaScript Utilities services in your applications Startup.ConfigureServices method.

using ShadyNagy.Blazor.JavaScriptUtilities;

public void ConfigureServices(IServiceCollection services)
{
    services.AddAllBlazorJavaScriptUtilities();
}

Also you can register what you need only ex

services.AddBlazorScrollController();

2. Add reference to style sheet & javascript reference

Add the following line to the head tag of your _Host.cshtml (Blazor Server) or index.html (Blazor WebAssembly).

<link rel="stylesheet" href="_content/ShadyNagy.Blazor.JavaScriptUtilities/blazor-javascript-utilities.min.css" />

Then add a reference to the Blazor Utilities JavaScript file at the bottom of the respective page after the reference to the Blazor file before </body>.

<script src="_content/ShadyNagy.Blazor.JavaScriptUtilities/blazor-javascript-utilities-min.js" type="text/javascript" language="javascript"></script>

3. Add Imports

Add the following to your _Imports.razor

@using ShadyNagy.Blazor.JavaScriptUtilities
@using ShadyNagy.Blazor.JavaScriptUtilities.Services
@using ShadyNagy.Blazor.JavaScriptUtilities.Constants

4. Add Injects

@inject IBlazorScrollController BlazorScrollController
@inject IBlazorCookie BlazorCookie

5. Examples

To hide both scrolls

await BlazorScrollController.HideBodyScrollOverflowAsync(ScrollType.Both);

Usage

Please checkout the sample projects in this repo to see working examples of the features in the Blazor JavaScript Utilities.

Blazor.JavaScriptUtilities

Utilities by JavaScript for Blazor

  • Local Storage Available to check if available in browser

  • Local Storage Set

  • Local Storage Read

  • Local Storage Remove by key

  • Local Storage Read All without keys

  • Local Storage Remove All

  • Local Storage Count

  • Local Storage Listener for changes

  • Session Storage Available to check if available in browser

  • Session Storage Set

  • Session Storage Read

  • Session Storage Remove by key

  • Session Storage Read All without keys

  • Session Storage Remove All

  • Session Storage Count

  • Session Storage Listener for changes

  • Scroll Hide

  • Scroll Show

  • Cookie Read

  • Cookie Delete

...... and more coming.

Local Storage
scrollbar-controller

Give a Star!

If you like or are using this project please give it a star. Thanks!

Getting Setup

You can install the package via the nuget package manager just search for ShadyNagy.Blazor.. You can also install via powershell using the following command.

Install-Package ShadyNagy.Blazor.JavaScriptUtilities

Or via the dotnet CLI.

dotnet add package ShadyNagy.Blazor.JavaScriptUtilities

1. Register Services

For Blazor WebAssembly: You will need to add the following using statement and add a call to register the Blazor JavaScript Utilities services in your applications Program.Main method.

using ShadyNagy.Blazor.JavaScriptUtilities;

public static async Task Main(string[] args)
{
    builder.Services.AddAllBlazorJavaScriptUtilities();
}

Also you can register what you need only ex

builder.Services.AddBlazorScrollController();

For Blazor Server: You will need to add the following using statement and add a call to register the Blazor JavaScript Utilities services in your applications Startup.ConfigureServices method.

using ShadyNagy.Blazor.JavaScriptUtilities;

public void ConfigureServices(IServiceCollection services)
{
    services.AddAllBlazorJavaScriptUtilities();
}

Also you can register what you need only ex

services.AddBlazorScrollController();

2. Add reference to style sheet & javascript reference

Add the following line to the head tag of your _Host.cshtml (Blazor Server) or index.html (Blazor WebAssembly).

<link rel="stylesheet" href="_content/ShadyNagy.Blazor.JavaScriptUtilities/blazor-javascript-utilities.min.css" />

Then add a reference to the Blazor Utilities JavaScript file at the bottom of the respective page after the reference to the Blazor file before </body>.

<script src="_content/ShadyNagy.Blazor.JavaScriptUtilities/blazor-javascript-utilities-min.js" type="text/javascript" language="javascript"></script>

3. Add Imports

Add the following to your _Imports.razor

@using ShadyNagy.Blazor.JavaScriptUtilities
@using ShadyNagy.Blazor.JavaScriptUtilities.Services
@using ShadyNagy.Blazor.JavaScriptUtilities.Constants

4. Add Injects

@inject IBlazorScrollController BlazorScrollController
@inject IBlazorCookie BlazorCookie

5. Examples

To hide both scrolls

await BlazorScrollController.HideBodyScrollOverflowAsync(ScrollType.Both);

Usage

Please checkout the sample projects in this repo to see working examples of the features in the Blazor JavaScript Utilities.

Release Notes

Session Storage Added.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.9 214 8/7/2020
1.0.8 196 8/3/2020
1.0.7 158 8/2/2020
1.0.6 167 8/2/2020
1.0.5 179 8/1/2020
1.0.4 192 8/1/2020
1.0.3 117 8/1/2020
1.0.2 157 7/31/2020
1.0.1 158 7/31/2020
1.0.0 155 7/31/2020