Soenneker.Blazor.Utils.ModuleImport 2.1.9

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
dotnet add package Soenneker.Blazor.Utils.ModuleImport --version 2.1.9
NuGet\Install-Package Soenneker.Blazor.Utils.ModuleImport -Version 2.1.9
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.ModuleImport" Version="2.1.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Soenneker.Blazor.Utils.ModuleImport --version 2.1.9
#r "nuget: Soenneker.Blazor.Utils.ModuleImport, 2.1.9"
#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.
// Install Soenneker.Blazor.Utils.ModuleImport as a Cake Addin
#addin nuget:?package=Soenneker.Blazor.Utils.ModuleImport&version=2.1.9

// Install Soenneker.Blazor.Utils.ModuleImport as a Cake Tool
#tool nuget:?package=Soenneker.Blazor.Utils.ModuleImport&version=2.1.9

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.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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (7)

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

Package Downloads
Soenneker.Blazor.FilePond The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

A Blazor interop library for the file upload library FilePond

Soenneker.Blazor.TomSelect The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

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

Soenneker.Blazor.Masonry The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

A Blazor interop library that integrates Masonry, the cascading grid layout library

Soenneker.Blazor.Clarity The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

A small Blazor interop library that sets up Microsoft Clarity

Soenneker.Blazor.ApplicationInsights The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org.

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.9 0 6/28/2024
2.1.8 0 6/28/2024
2.1.7 37 6/27/2024
2.1.6 39 6/27/2024
2.1.5 17 6/27/2024
2.1.4 172 6/27/2024
2.1.3 239 6/23/2024
2.1.2 52 6/23/2024
2.1.1 55 6/23/2024