Show / Hide Table of Contents

Class SharedStateWhenExtensions

Extension methods on the shared state than create an Autorun that observes and runs the given predicate until it returns true. Once that happens, the given effect is executed and the autorunner is disposed. The function returns a disposer to cancel the autorunner prematurely.

Inheritance
System.Object
SharedStateWhenExtensions
Namespace: Cortex.Net.Api
Assembly: Cortex.Net.dll
Syntax
public static class SharedStateWhenExtensions : object

Methods

| Improve this Doc View Source

When(ISharedState, Func<Boolean>, Action, WhenOptions)

Creates an autorun that observes and runs the given predicate until it returns true. Once that happens, the given effect is executed and the autorunner is disposed. The function returns a disposer to cancel the autorunner prematurely.

Declaration
public static IDisposable When(this ISharedState sharedState, Func<bool> predicate, Action effect, WhenOptions whenOptions = null)
Parameters
Type Name Description
ISharedState sharedState

The shared state to use.

Func<System.Boolean> predicate

The predicate to match.

Action effect

The effect to run.

WhenOptions whenOptions

The options for this When.

Returns
Type Description
IDisposable

A disposer to cancel the autorunner prematurely.

| Improve this Doc View Source

When(ISharedState, Func<Boolean>, CancellationToken, WhenOptions)

Creates an autorun that observes and runs the given predicate until it returns true. Once that happens, the given effect is executed and the autorunner is disposed. The function returns a disposer to cancel the autorunner prematurely.

Declaration
public static Task When(this ISharedState sharedState, Func<bool> predicate, CancellationToken cancellationToken, WhenOptions whenOptions = null)
Parameters
Type Name Description
ISharedState sharedState

The shared state to use.

Func<System.Boolean> predicate

The predicate to match.

CancellationToken cancellationToken

The cancellation token to cancel the operation.

WhenOptions whenOptions

The options for this When.

Returns
Type Description
Task

A task to await in asynchronous code..

| Improve this Doc View Source

When(ISharedState, Func<Boolean>, WhenOptions)

Creates an autorun that observes and runs the given predicate until it returns true. Once that happens, the given effect is executed and the autorunner is disposed. The function returns a disposer to cancel the autorunner prematurely.

Declaration
public static Task When(this ISharedState sharedState, Func<bool> predicate, WhenOptions whenOptions = null)
Parameters
Type Name Description
ISharedState sharedState

The shared state to use.

Func<System.Boolean> predicate

The predicate to match.

WhenOptions whenOptions

The options for this When.

Returns
Type Description
Task

A task to await in asynchronous code..

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX