ObservableBlazor 0.1.12-pre

This is a prerelease version of ObservableBlazor.
There is a newer prerelease version of this package available.
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                
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="ObservableBlazor" Version="0.1.12-pre" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ObservableBlazor --version 0.1.12-pre                
#r "nuget: ObservableBlazor, 0.1.12-pre"                
#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 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

Demo available here

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 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

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