Class ObserverObject
Observer object that encapsulates a reaction to automatically track dependencies and rerender when any of the dependencies change.
Inheritance
Implements
Inherited Members
Namespace: Cortex.Net.Blazor
Assembly: Cortex.Net.Blazor.dll
Syntax
public sealed class ObserverObject : IDisposable
Constructors
| Improve this Doc View SourceObserverObject(ISharedState, String, Action<RenderTreeBuilder>, Action)
Initializes a new instance of the ObserverObject class.
Declaration
public ObserverObject(ISharedState sharedState, string name, Action<RenderTreeBuilder> buildRenderTreeAction, Action stateChangedAction)
Parameters
| Type | Name | Description |
|---|---|---|
| ISharedState | sharedState | The shared state this observer is connected to. |
| System.String | name | The name of the observer. |
| System.Action<RenderTreeBuilder> | buildRenderTreeAction | The action that should be executed to build the render tree. |
| System.Action | stateChangedAction | The action that is used to force StateHasChanged for this Component. |
Methods
| Improve this Doc View SourceBuildRenderTree(RenderTreeBuilder)
Builds the render tree for the Component and automatically tracks dependencies.
Declaration
public void BuildRenderTree(RenderTreeBuilder renderTreeBuilder)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderTreeBuilder | renderTreeBuilder | The render tree builder to use. |
Dispose()
Disposes the internal reaction that is used to track dependenies.
Declaration
public void Dispose()
ReactiveRenderFragment(RenderFragment)
Creates a reactive RenderFragment that tracks a RenderFragment. and Invokes the StateHasChanged action passed in the constructor when any of the fragments have changed.
Declaration
public RenderFragment ReactiveRenderFragment(RenderFragment renderFragment)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderFragment | renderFragment | The render fragment to track. |
Returns
| Type | Description |
|---|---|
| RenderFragment | A new Renderfragment that wraps the old one. |
ReactiveRenderFragment<T>(RenderFragment<T>)
Creates a reactive RenderFragment that tracks a RenderFragment. and Invokes the StateHasChanged action passed in the constructor when any of the fragments have changed.
Declaration
public RenderFragment<T> ReactiveRenderFragment<T>(RenderFragment<T> renderFragment)
Parameters
| Type | Name | Description |
|---|---|---|
| RenderFragment<T> | renderFragment | The render fragment to encapsulate. |
Returns
| Type | Description |
|---|---|
| RenderFragment<T> | The encapsulated render framgent. |
Type Parameters
| Name | Description |
|---|---|
| T | The type of the argument. |