Soenneker.Blazor.CallbackRegistry 11.0.1237

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Blazor.CallbackRegistry --version 11.0.1237
                    
NuGet\Install-Package Soenneker.Blazor.CallbackRegistry -Version 11.0.1237
                    
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.CallbackRegistry" Version="11.0.1237" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Blazor.CallbackRegistry" Version="11.0.1237" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Blazor.CallbackRegistry" />
                    
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.CallbackRegistry --version 11.0.1237
                    
#r "nuget: Soenneker.Blazor.CallbackRegistry, 11.0.1237"
                    
#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.CallbackRegistry@11.0.1237
                    
#: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.CallbackRegistry&version=11.0.1237
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Blazor.CallbackRegistry&version=11.0.1237
                    
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.CallbackRegistry

A scoped bridge for routing JavaScript events to typed, instance-specific .NET callbacks by ID.

Installation and registration

dotnet add package Soenneker.Blazor.CallbackRegistry
using Soenneker.Blazor.CallbackRegistry.Registrars;

builder.Services.AddBlazorCallbackRegistryAsScoped();

Register a callback

Register after the component's first render so JavaScript interop is available. Unregister component-owned IDs when the component is disposed.

@implements IDisposable
@inject IBlazorCallbackRegistry CallbackRegistry

@code {
    private const string CallbackId = "orders:active";

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
            await CallbackRegistry.Register<OrderUpdated>(CallbackId, OnOrderUpdated);
    }

    private Task OnOrderUpdated(OrderUpdated update)
    {
        // Apply the update and refresh component state as needed.
        return Task.CompletedTask;
    }

    public void Dispose() => CallbackRegistry.Unregister(CallbackId);
}

Registering the same ID again replaces its callback. IDs share the registry's DI scope, so use stable, collision-resistant names for independently rendered components. The stateful overload stores a state value with the callback:

await CallbackRegistry.Register<MyComponent, OrderUpdated>(
    callbackId,
    this,
    static (component, update) => component.OnOrderUpdated(update));

Send an event from JavaScript

Import the package module using the application's base URI, then await sendToCallback so .NET deserialization or callback failures are observable by JavaScript:

const callbackRegistry = await import(new URL(
    "_content/Soenneker.Blazor.CallbackRegistry/js/callbackregistryinterop.js",
    document.baseURI));

await callbackRegistry.sendToCallback("orders:active", {
    orderId: "2d8f1d42",
    status: "shipped"
});

The payload is serialized in JavaScript and deserialized as the registered generic type in .NET. Keep payload types JSON-compatible. A missing ID is ignored; malformed JSON or a callback exception rejects the JavaScript promise.

IBlazorCallbackRegistry is scoped and owns the JavaScript bridge reference. Let DI dispose it. Do not manually dispose an injected registry while other components in the same scope may still use it.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
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.CallbackRegistry:

Package Downloads
Soenneker.Maui.Blazor.Bridge

Seamlessly connects MAUI and Blazor, enabling smooth integration of native components into Blazor

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.1254 136 11/19/2026
11.0.1253 85 11/19/2026
11.0.1252 81 11/19/2026
11.0.1251 83 11/19/2026
11.0.1250 79 11/19/2026
11.0.1249 83 11/19/2026
11.0.1248 83 11/18/2026
11.0.1247 81 11/18/2026
11.0.1246 87 11/18/2026
11.0.1242 87 11/18/2026
11.0.1241 99 11/18/2026
11.0.1240 131 11/16/2026
11.0.1239 113 11/16/2026
11.0.1238 106 11/15/2026
11.0.1237 106 11/15/2026
11.0.1236 96 11/15/2026
11.0.1235 104 11/15/2026
11.0.1234 117 11/15/2026
11.0.1233 115 11/15/2026
11.0.1232 117 11/14/2026
Loading failed

Updated Multiple NuGet packages