Soenneker.Blazor.Utils.JsVariable 4.0.1359

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Blazor.Utils.JsVariable --version 4.0.1359
                    
NuGet\Install-Package Soenneker.Blazor.Utils.JsVariable -Version 4.0.1359
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Blazor.Utils.JsVariable" Version="4.0.1359" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Blazor.Utils.JsVariable" Version="4.0.1359" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Blazor.Utils.JsVariable" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Blazor.Utils.JsVariable --version 4.0.1359
                    
#r "nuget: Soenneker.Blazor.Utils.JsVariable, 4.0.1359"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Blazor.Utils.JsVariable@4.0.1359
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Blazor.Utils.JsVariable&version=4.0.1359
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Blazor.Utils.JsVariable&version=4.0.1359
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Blazor.Utils.JsVariable

A Blazor interop library that checks (and waits) for the existence of a JS variable.

Install

dotnet add package Soenneker.Blazor.Utils.JsVariable

Quick start

using Soenneker.Blazor.Utils.JsVariable.Registrars;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
var result = services.AddJsVariableInteropAsScoped();

Adds IJsVariableInterop as a scoped service.

What you get

  • IJsVariableInterop — A Blazor interop library that checks (and waits) for the existence of a JS variable.
  • JsVariableInteropRegistrar — Registers the Blazor interop service that checks for a JavaScript variable and can wait for it to appear.

API at a glance

API What it does Result / important behavior
IJsVariableInterop.IsVariableAvailable(variableName, cancellationToken) Asynchronously checks if a JavaScript variable is available in the global scope. A ValueTask{TResult} that represents the asynchronous operation, containing true if the variable is available; otherwise, false.
IJsVariableInterop.WaitForVariable(variableName, delay, timeout, cancellationToken) Asynchronously waits until a specified JavaScript variable is available in the global scope. A ValueTask that represents the asynchronous operation.
JsVariableInteropRegistrar.AddJsVariableInteropAsScoped(services) Adds IJsVariableInterop as a scoped service. The same service collection, so additional registrations can be chained.

Important behavior

  • IJsVariableInterop.IsVariableAvailable(variableName, cancellationToken): This method ensures the necessary JavaScript is injected before checking for the variable.
  • IJsVariableInterop.WaitForVariable(variableName, delay, timeout, cancellationToken): This method ensures the necessary JavaScript is injected and repeatedly checks for the variable's availability until it becomes available or the operation is canceled.

Practical notes

  • Cancellation stops pending work; it does not undo work that has already completed.
  • Dispose instances you own when their scope ends so held resources can be released.
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.Blazor.Utils.JsVariable:

Package Downloads
Soenneker.Blazor.Utils.ResourceLoader

A Blazor JavaScript interop for dynamically loading scripts, styles, and modules

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.1363 0 8/30/2026
4.0.1362 0 8/30/2026
4.0.1361 0 8/30/2026
4.0.1359 21 8/29/2026
4.0.1358 27 8/29/2026
4.0.1357 38 8/29/2026
4.0.1356 1,209 8/26/2026
4.0.1355 421 8/26/2026
4.0.1354 2,543 8/21/2026
4.0.1353 2,653 8/18/2026
4.0.1352 1,864 8/13/2026
4.0.1351 720 8/12/2026
4.0.1350 3,142 8/9/2026
4.0.1349 1,616 8/8/2026
4.0.1348 583 8/8/2026
4.0.1347 2,925 8/7/2026
4.0.1346 2,494 7/29/2026
4.0.1345 2,148 7/29/2026
4.0.1344 337 7/28/2026
4.0.1343 402 7/28/2026
Loading failed

Improve README usability and API guidance