ObservableBlazor 0.1.12-pre
See the version list below for details.
dotnet add package ObservableBlazor --version 0.1.12-pre
NuGet\Install-Package ObservableBlazor -Version 0.1.12-pre
<PackageReference Include="ObservableBlazor" Version="0.1.12-pre" />
paket add ObservableBlazor --version 0.1.12-pre
#r "nuget: ObservableBlazor, 0.1.12-pre"
// Install ObservableBlazor as a Cake Addin #addin nuget:?package=ObservableBlazor&version=0.1.12-pre&prerelease // Install ObservableBlazor as a Cake Tool #tool nuget:?package=ObservableBlazor&version=0.1.12-pre&prerelease
Observable Section
Provides way of tracking observable subscriptions in Blazor.
Demo
Overview
The main logic is handled in ObservableSection Component. It subscribes to observables and provides last value during binding. Also it tracks the observable usages while it is being rendered. So it can, dispose all subscriptions that were not touched during rendering. Since they are not active any more.
Main method to use is ObservableSection.Bind()
or Bind extension method for IObservable
.
This subscribes to the observable (if it is used first time) and returns the last value the observable had.
Example usage
<ObservableSection>
<p>Current count: @currentCount.Bind(context)</p>
<button class="btn btn-primary" @onclick="()=>currentCount.OnNext(currentCount.Bind(context))">Click me</button>
</ObservableSection>
The example project contains the sample Blazor App with reimplemented the Counter and FetchData pages using observables. The Index page is extended with demo of observables of observables (user manipulation of simple tree structure), see TreeItemCard for more.
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.AspNetCore.Components (>= 8.0.8)
- Microsoft.AspNetCore.Components.Web (>= 8.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.1.13-pre | 54 | 8/30/2024 |
0.1.12-pre | 57 | 8/30/2024 |
0.1.11-pre | 49 | 8/30/2024 |
0.1.9-pre | 51 | 8/30/2024 |
0.1.8-pre | 52 | 8/30/2024 |