Class ObservableExtensions
Extension methods for the IObservable interface.
Inheritance
Namespace: Cortex.Net.Core
Assembly: Cortex.Net.dll
Syntax
public static class ObservableExtensions : object
Methods
| Improve this Doc View SourceAddObserver(IObservable, IDerivation)
Adds an observer that implements IDerivation into the set of observers. for this IObservable instance.
Declaration
public static void AddObserver(this IObservable observable, IDerivation derivation)
Parameters
Type | Name | Description |
---|---|---|
IObservable | observable | The observable to use. |
IDerivation | derivation | The observer to add. |
HasObservers(IObservable)
Indicates whether the observable has Observers or not.
Declaration
public static bool HasObservers(this IObservable observable)
Parameters
Type | Name | Description |
---|---|---|
IObservable | observable | The observable to check for observers. |
Returns
Type | Description |
---|---|
System.Boolean | A boolean indicating whether the observable has observers or not. |
IsComputedValue(IObservable)
Checks whether the observable is a derivation as well.
Declaration
public static bool IsComputedValue(this IObservable observable)
Parameters
Type | Name | Description |
---|---|---|
IObservable | observable | The observable to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the observable is a derivation, false otherwise. |
IsDerivation(IObservable)
Checks whether the observable is a derivation as well.
Declaration
public static bool IsDerivation(this IObservable observable)
Parameters
Type | Name | Description |
---|---|---|
IObservable | observable | The observable to check. |
Returns
Type | Description |
---|---|
System.Boolean | True if the observable is a derivation, false otherwise. |
PropagateChangeConfirmed(IObservable)
Propagates confirmation of a change to all observers of this observable.
Declaration
public static void PropagateChangeConfirmed(this IObservable observable)
Parameters
Type | Name | Description |
---|---|---|
IObservable | observable | The observable. |
Remarks
Called by ComputedValue when it recalculate and its value changed.
PropagateChanged(IObservable)
Propagates a change to all observers of this observable.
Declaration
public static void PropagateChanged(this IObservable observable)
Parameters
Type | Name | Description |
---|---|---|
IObservable | observable | The observable. |
Remarks
Called by Atom when its value has changed.
PropagateMaybeChanged(IObservable)
Propagates confirmation of a possible change to all observers of this observable for delayed computation.
Declaration
public static void PropagateMaybeChanged(this IObservable observable)
Parameters
Type | Name | Description |
---|---|---|
IObservable | observable | The observable. |
Remarks
Called by ComputedValue when its dependency changed, but we don't wan't to immediately recompute.
RemoveObserver(IObservable, IDerivation)
Removes an Observer IDerivation from the set of observers.
Declaration
public static void RemoveObserver(this IObservable observable, IDerivation derivation)
Parameters
Type | Name | Description |
---|---|---|
IObservable | observable | The observable to use. |
IDerivation | derivation | The observer to add. |
ReportObserved(IObservable)
Report an observable as being observed to the current tracking derivation (observer).
Declaration
public static bool ReportObserved(this IObservable observable)
Parameters
Type | Name | Description |
---|---|---|
IObservable | observable | The observable. |
Returns
Type | Description |
---|---|
System.Boolean | True when this observable is added to the "new observing" set of the derivation. |
Remarks
This method will write to the debug log when state reads are currently not allowed.