FluentSignals 1.1.0
See the version list below for details.
dotnet add package FluentSignals --version 1.1.0
NuGet\Install-Package FluentSignals -Version 1.1.0
<PackageReference Include="FluentSignals" Version="1.1.0" />
<PackageVersion Include="FluentSignals" Version="1.1.0" />
<PackageReference Include="FluentSignals" />
paket add FluentSignals --version 1.1.0
#r "nuget: FluentSignals, 1.1.0"
#:package FluentSignals@1.1.0
#addin nuget:?package=FluentSignals&version=1.1.0
#tool nuget:?package=FluentSignals&version=1.1.0
FluentSignals
A powerful reactive state management library for .NET applications inspired by SolidJS signals. FluentSignals provides fine-grained reactivity with automatic dependency tracking, making it perfect for building responsive applications with minimal boilerplate.
Features
- 🚀 Fine-grained reactivity - Only update what needs to be updated
- 🔄 Automatic dependency tracking - No need to manually manage subscriptions
- 📦 Typed and untyped signals - Use
Signal<T>
for type safety orSignal
for flexibility - ⚡ Async signals - Built-in support for asynchronous operations
- 🌊 Computed signals - Automatically derive values from other signals
- 🎯 Resource management - Generic resource pattern with loading/error states
- 🌐 HTTP resources - Built-in HTTP client with caching and retry policies
- 🔌 Extensible - Easy to extend with custom signal types
Installation
dotnet add package FluentSignals
Quick Start
Basic Signal Usage
using FluentSignals;
// Create a signal
var count = new Signal<int>(0);
// Subscribe to changes
count.Subscribe(value => Console.WriteLine($"Count is now: {value}"));
// Update the signal
count.Value = 1; // Output: Count is now: 1
count.Value = 2; // Output: Count is now: 2
Computed Signals
var firstName = new Signal<string>("John");
var lastName = new Signal<string>("Doe");
// Create a computed signal
var fullName = new ComputedSignal<string>(() => $"{firstName.Value} {lastName.Value}");
fullName.Subscribe(name => Console.WriteLine($"Full name: {name}"));
firstName.Value = "Jane"; // Output: Full name: Jane Doe
Async Signals
var asyncSignal = new AsyncSignal<string>(async () =>
{
await Task.Delay(1000);
return "Data loaded!";
});
// Access the value
await asyncSignal.GetValueAsync(); // Returns "Data loaded!" after 1 second
Resource Signals
// Create a resource with a fetcher function
var userResource = new ResourceSignal<User>(
async (ct) => await LoadUserFromDatabase(userId, ct)
);
// Subscribe to state changes
userResource.Subscribe(state =>
{
if (state.IsLoading) Console.WriteLine("Loading...");
if (state.HasData) Console.WriteLine($"User: {state.Data.Name}");
if (state.HasError) Console.WriteLine($"Error: {state.Error.Message}");
});
// Load the resource
await userResource.LoadAsync();
HTTP Resources
services.AddFluentSignalsHttpResource(options =>
{
options.WithBaseUrl("https://api.example.com")
.WithTimeout(TimeSpan.FromSeconds(30));
});
// Create an HTTP resource
var userResource = new HttpResource<User>("/users/1", httpClient);
// Subscribe and fetch
await userResource.LoadAsync();
Advanced Features
Signal Bus (Pub/Sub)
// Publisher
services.AddScoped<ISignalPublisher>();
await signalPublisher.PublishAsync(new UserCreatedEvent { UserId = 123 });
// Consumer
services.AddScoped<ISignalConsumer<UserCreatedEvent>>();
signalConsumer.Subscribe(message =>
{
Console.WriteLine($"User created: {message.UserId}");
});
Queue-based Subscriptions
// Subscribe with message queue - receives all messages, even those published before subscription
subscription = signalConsumer.SubscribeByQueue(message =>
{
ProcessMessage(message);
}, processExistingMessages: true);
Integration with Blazor
FluentSignals integrates seamlessly with Blazor applications. See the FluentSignals.Blazor
package for Blazor-specific features and components.
Documentation
For more detailed documentation, examples, and API reference, visit our GitHub repository.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.6)
- Microsoft.Extensions.Http (>= 9.0.6)
- Polly (>= 8.6.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on FluentSignals:
Package | Downloads |
---|---|
FluentSignals.Blazor
Blazor integration for FluentSignals - A reactive state management library. Includes SignalBus for component communication, HTTP resource components, typed resource factories, and Blazor-specific helpers. |
|
FluentSignals.SignalBus
Event bus and messaging patterns for FluentSignals including publish/subscribe, message queuing, and advanced patterns like batching and multi-tenancy. |
|
FluentSignals.SignalR
SignalR integration for FluentSignals providing real-time reactive resources with automatic reconnection and state management. |
|
FluentSignals.Http
HTTP client extensions for FluentSignals including reactive HTTP resources, typed API clients, interceptors, caching, and advanced features for building robust HTTP integrations. |
GitHub repositories
This package is not used by any popular GitHub repositories.