Soenneker.Blazor.Utils.ResourceLoader 4.0.1591

Prefix Reserved
dotnet add package Soenneker.Blazor.Utils.ResourceLoader --version 4.0.1591
                    
NuGet\Install-Package Soenneker.Blazor.Utils.ResourceLoader -Version 4.0.1591
                    
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.ResourceLoader" Version="4.0.1591" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Blazor.Utils.ResourceLoader" Version="4.0.1591" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Blazor.Utils.ResourceLoader" />
                    
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.ResourceLoader --version 4.0.1591
                    
#r "nuget: Soenneker.Blazor.Utils.ResourceLoader, 4.0.1591"
                    
#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.ResourceLoader@4.0.1591
                    
#: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.ResourceLoader&version=4.0.1591
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Blazor.Utils.ResourceLoader&version=4.0.1591
                    
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.ResourceLoader

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

Overview

The ResourceLoader class is designed to manage the loading and initialization of scripts, styles, and JavaScript modules in a Blazor application. It provides methods to asynchronously load scripts and styles, wait for variables to be available, and manage the lifecycle of JavaScript modules.

It ensures that each resource is only loaded once (through this interop), even with multiple concurrent calls.

Table of Contents

Installation

dotnet add package Soenneker.Blazor.Utils.ResourceLoader

Usage

Loading Scripts

To load a script, use the LoadScript method. It injects the file into the DOM.

await resourceLoader.LoadScript("https://example.com/script.js");

LoadScriptAndWaitForVariable is also available. It waits for a specified JavaScript variable to be available:

await resourceLoader.LoadScriptAndWaitForVariable("https://example.com/script.js", "variableName");

Loading Styles

To load a style, use the LoadStyle method. It injects the file into the DOM.

await resourceLoader.LoadStyle("https://example.com/style.css");

Importing Modules

To import a JavaScript module, use the ImportModule method:

var module = await resourceLoader.ImportModule("moduleName");

You probably want ImportModuleAndWaitUntilAvailable, as that waits until the module is loaded, and accessible:

// 'ResourceLoader' is the name of the export class
var module = await resourceLoader.ImportModuleAndWaitUntilAvailable("Soenneker.Blazor.Utils.ResourceLoader/resourceloader.js", "ResourceLoader");

Waiting for Variables

To wait for a JavaScript variable to be available, use the WaitForVariable method:

await resourceLoader.WaitForVariable("variableName");

Disposing Modules

Be sure to dispose of a module after you're done interacting with it. To dispose of a JavaScript module, use the DisposeModule method:

await resourceLoader.DisposeModule("moduleName");
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 (26)

Showing the top 5 NuGet packages that depend on Soenneker.Blazor.Utils.ResourceLoader:

Package Downloads
Soenneker.Blazor.TomSelect

A Blazor interop library for the select user control library, Tom Select

Soenneker.Blazor.FilePond

A Blazor interop library for the file upload library FilePond

Soenneker.Blazor.Clarity

A small Blazor interop library that sets up Microsoft Clarity

Soenneker.Blazor.Masonry

A lightweight, responsive Blazor component for Masonry (the cascading grid layout library) — perfect for image grids, cards, and dynamic content.

Soenneker.Blazor.LogJson

A Blazor interop library that logs JSON (like HTTP requests/responses) within the browser

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
4.0.1591 249 2/12/2026
4.0.1590 353 2/12/2026
4.0.1589 421 2/12/2026
4.0.1588 368 2/11/2026
4.0.1587 649 2/11/2026
4.0.1586 933 2/10/2026
4.0.1585 1,760 2/6/2026
4.0.1584 423 2/6/2026
4.0.1583 2,692 1/27/2026
4.0.1582 311 1/27/2026
4.0.1581 193 1/26/2026
4.0.1580 106 1/26/2026
4.0.1579 104 1/26/2026
4.0.1578 1,580 1/23/2026
4.0.1577 361 1/22/2026
4.0.1576 559 1/22/2026
4.0.1575 977 1/21/2026
4.0.1574 473 1/21/2026
4.0.1573 1,896 1/14/2026
4.0.1572 618 1/14/2026
Loading failed