FluxLib 1.1.0

dotnet add package FluxLib --version 1.1.0
                    
NuGet\Install-Package FluxLib -Version 1.1.0
                    
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="FluxLib" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FluxLib" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="FluxLib" />
                    
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 FluxLib --version 1.1.0
                    
#r "nuget: FluxLib, 1.1.0"
                    
#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 FluxLib@1.1.0
                    
#: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=FluxLib&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=FluxLib&version=1.1.0
                    
Install as a Cake Tool

FluxLib

A library to support flux design.

Flux design

+---------+        +-------------+        +--------+        +--------+
| Action  | -----> | Dispatcher  | -----> | Store  | -----> |  View  |
+---------+        +-------------+        +--------+        +--------+
     ^                                                       |
     |-------------------------------------------------------+
                   (User interaction triggers new Action)
  1. User interacts with the View (e.g., clicking a button).
  2. This triggers an Action.
  3. The Dispatcher receives the action and sends it to the appropriate Store.
  4. The Store updates its internal state based on the action.
  5. The Store emits a change event.
  6. The View listens for these changes and re-renders accordingly.
  7. The cycle repeats as the user continues to interact.

Explanation of this library

This library provides the following components: DispatchCenter, IStore, ActionArgs, and DataArgs.

  • ActionArgs is a class used to define the action type and the data required for that action. It facilitates communication in the flow: View -> Dispatcher -> Store.
  • DataArgs is a class used to define the data type and the data being passed. It facilitates communication in the flow: Store -> View.
  1. The DispatchCenter class receives ActionArgs from the View and broadcasts them to all IStore instances that are listening to it.

Example: Listening for an action in a Store

// SimpleAction is an enum that defines various actions associated with `SimpleView`
_dispatchCenter.AddListener(typeof(SimpleAction), ActionReceived);  

private void ActionReceived(object? sender, ActionArgs e) { 
    ...
}
  1. The Store processes the received action and emits a change event to all Views that are subscribed to it.

Example: Emiting a change in a Store

var data = new DataArgs();
data.AddData(SimpleTag.Text, str);

// Push the processed result to the subscribers
Changed?.Invoke(this, data);  // `Changed` is the event defined in `IStore`

Example: Listening for changes in a View

public SimpleView(DispatchCenter dispatchCenter, SimpleStore store)
{
    _dispatcherCenter = dispatchCenter;

    _store = store;
    _store.Changed += Store_Changed;  // Subscribe to store change events
}
  1. The View sends actions to the DispatchCenter.

Example: Sending an action to DispatchCenter

var action = new ActionArgs(SimpleAction.Repeat);
action.AddData(SimpleTag.Text, input);

// Dispatch the action to all subscribers
_dispatcherCenter.DispatchEvent(action);
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.  net9.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

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
1.1.0 372 7/9/2025