jsakamoto / Toolbelt.Blazor.GetProperty.Script

Add a tiny JavaScript function out-of-the-box to get JavaScript property values in your Blazor apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blazor GetProperty Script NuGet Package

Summary

Once you've installed this NuGet package to your Blazor application,

dotnet add package Toolbelt.Blazor.GetProperty.Script

you can use the Toolbelt.Blazor.getProperty global JavaScript function in your Blazor application. The Toolbelt.Blazor.getProperty allows you to retrieve any global property values specified by dot-separated property path string without any additional installations and configurations, like below.

@inject IJSRuntime JSRuntime

@code
{
  protected override async Task OnAfterRenderAsync(bool firstRender)
  {
    if (firstRender)
    {
      var onLine = await JSRuntime.InvokeAsync<bool>("Toolbelt.Blazor.getProperty", "navigator.onLine");
    }
  }
}

Release Note

Release notes

License

Mozilla Public License Version 2.0

About

Add a tiny JavaScript function out-of-the-box to get JavaScript property values in your Blazor apps.

License:Mozilla Public License 2.0


Languages

Language:CSS 45.0%Language:HTML 42.7%Language:C# 9.3%Language:JavaScript 3.0%