Soenneker.Blazor.Utils.ModuleImport
2.1.3
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Blazor.Utils.ModuleImport --version 2.1.3
NuGet\Install-Package Soenneker.Blazor.Utils.ModuleImport -Version 2.1.3
<PackageReference Include="Soenneker.Blazor.Utils.ModuleImport" Version="2.1.3" />
paket add Soenneker.Blazor.Utils.ModuleImport --version 2.1.3
#r "nuget: Soenneker.Blazor.Utils.ModuleImport, 2.1.3"
// Install Soenneker.Blazor.Utils.ModuleImport as a Cake Addin
#addin nuget:?package=Soenneker.Blazor.Utils.ModuleImport&version=2.1.3
// Install Soenneker.Blazor.Utils.ModuleImport as a Cake Tool
#tool nuget:?package=Soenneker.Blazor.Utils.ModuleImport&version=2.1.3
Soenneker.Blazor.Utils.ModuleImport
A Blazor utility library assisting with asynchronous module loading
This library simplifies the process of loading JavaScript modules and provides methods for waiting until a module is loaded and disposing of modules when they are no longer needed.
Features
- Import JavaScript modules dynamically.
- Wait until a module is fully loaded.
- Dispose of JavaScript modules when they are no longer needed.
- Singleton pattern to ensure that each module is loaded only once.
Installation
To install, add the package to your Blazor project using the .NET CLI:
dotnet add package Soenneker.Blazor.Utils.ModuleImport
Register it in DI:
builder.Services.AddModuleImportUtil();
Example
Here's an example of how to use the ModuleImportUtil
in a Blazor component:
@page "/example"
@inject IModuleImportUtil ModuleImportUtil
@implements IAsyncDisposable
<h3>Module Import Example</h3>
<button @onclick="LoadModule">Load Module</button>
@code {
private async Task LoadModule()
{
var module = await ModuleImportUtil.Import("exampleModule");
await ModuleImportUtil.WaitUntilLoaded("exampleModule");
// Guaranteed that the module has been added to the DOM, and available at this point
}
public async ValueTask DisposeAsync()
{
await ModuleImportUtil.DisposeModule("exampleModule");
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.JSInterop (>= 8.0.6)
- Soenneker.Utils.SingletonDictionary (>= 2.1.305)
NuGet packages (8)
Showing the top 5 NuGet packages that depend on Soenneker.Blazor.Utils.ModuleImport:
Package | Downloads |
---|---|
Soenneker.Blazor.FilePond
A Blazor interop library for the file upload library FilePond |
|
Soenneker.Blazor.TomSelect
A Blazor interop library for the select user control library, Tom Select |
|
Soenneker.Blazor.Masonry
A Blazor interop library that integrates Masonry, the cascading grid layout library |
|
Soenneker.Blazor.Clarity
A small Blazor interop library that sets up Microsoft Clarity |
|
Soenneker.Blazor.ApplicationInsights
A Blazor interop library that sets up client-side Application Insights |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.1.16 | 0 | 6/30/2024 |
2.1.15 | 0 | 6/30/2024 |
2.1.14 | 0 | 6/30/2024 |
2.1.13 | 0 | 6/30/2024 |
2.1.12 | 64 | 6/30/2024 |
2.1.11 | 120 | 6/28/2024 |
2.1.10 | 32 | 6/28/2024 |
2.1.9 | 64 | 6/28/2024 |
2.1.8 | 44 | 6/28/2024 |
2.1.7 | 70 | 6/27/2024 |
2.1.6 | 51 | 6/27/2024 |
2.1.5 | 29 | 6/27/2024 |
2.1.4 | 178 | 6/27/2024 |
2.1.3 | 240 | 6/23/2024 |
2.1.2 | 52 | 6/23/2024 |
2.1.1 | 55 | 6/23/2024 |