ElmishRuntimeType

PackageAxial.ElmishFlows

ElmishRuntime

ElmishRuntime<'env> owns the root scope for all commands in one Elmish program. Create one per program with ElmishRuntime.start, passing an environment and a Post function that delivers callbacks on the host's dispatch thread.

Construction

ElmishRuntime.start options environment builds a runtime from ElmishRuntimeOptions (Post, OnDefect, HistoryCapacity). When already on the dispatch thread, Post should run inline; otherwise it should post to it. Do not call Elmish's dispatch directly from workers. Connect OnDefect to the host's crash reporting path; typed failures are messages, but defects are not.

The runtime requires an environment implementing IHasClock. Keep that clock environment stable, and supply a command's current dependencies with Flow.localEnv.

Shutdown

  • runtime.StopAndWait timeout interrupts commands and subscriptions, waits for their finalizers, and returns false on timeout; it is safe from a single-threaded UI context.
  • runtime.Stop() is the asynchronous alternative.

Specification

Kind
Type
Members
7
Examples
0
startSignature
ElmishRuntime.start options environment
startLayerSignature
ElmishRuntime.startLayer options layer input
testSignature
ElmishRuntime.test environment
StopSignature
this.Stop
StopAndWaitSignature
this.StopAndWait

Summary

NameSignatureSynopsis
Operations
startElmishRuntime.start options environmentStarts a runtime around a caller-supplied environment.
startLayerElmishRuntime.startLayer options layer inputStarts a runtime by provisioning a layer inside the runtime's root scope.
testElmishRuntime.test environmentCreates a runtime with queued dispatch and captured defects for tests.
Stopthis.StopNo description available.
StopAndWaitthis.StopAndWaitNo description available.
Registrythis.RegistryNo description available.
Environmentthis.EnvironmentNo description available.

Operations

kind:member

start

ElmishRuntime.start options environment
Member
Starts a runtime around a caller-supplied environment.

Parameters

NameTypeDescription
optionsElmishRuntimeOptionsHost delivery and diagnostic policy.
environment'envThe environment every command runs with; it must implement IHasClock.

Returns

ElmishRuntime<'env>
kind:member

startLayer

ElmishRuntime.startLayer options layer input
Member
Starts a runtime by provisioning a layer inside the runtime's root scope.

Parameters

NameTypeDescription
optionsElmishRuntimeOptionsHost delivery and diagnostic policy.
layerLayer<'input, 'error, 'env>The layer that builds the runtime's environment.
input'inputThe input environment required to build the layer.

Returns

Async<Result<ElmishRuntime<'env>, 'error>>
kind:member

test

ElmishRuntime.test environment
Member
Creates a runtime with queued dispatch and captured defects for tests.

Parameters

NameTypeDescription
environment'env

Returns

TestRuntime<'env>
kind:member

Stop

this.Stop
Member

Returns

Async<unit>
kind:member

StopAndWait

this.StopAndWait
Member

Parameters

NameTypeDescription
timeoutTimeSpan

Returns

bool
kind:member

Registry

this.Registry
Member

Returns

FiberRegistry
kind:member

Environment

this.Environment
Member

Returns

'env