Skip to content

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

License

Notifications You must be signed in to change notification settings

jsakamoto/Toolbelt.Blazor.GetProperty.Script

Repository files navigation

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.

Topics

Resources

License

Stars

Watchers

Forks