ElmishRuntimeType
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 timeoutinterrupts commands and subscriptions, waits for their finalizers, and returnsfalseon timeout; it is safe from a single-threaded UI context.runtime.Stop()is the asynchronous alternative.
Specification
Summary
| Name | Signature | Synopsis |
|---|---|---|
| Operations | ||
| start | ElmishRuntime.start options environment | Starts a runtime around a caller-supplied environment. |
| startLayer | ElmishRuntime.startLayer options layer input | Starts a runtime by provisioning a layer inside the runtime's root scope. |
| test | ElmishRuntime.test environment | Creates a runtime with queued dispatch and captured defects for tests. |
| Stop | this.Stop | No description available. |
| StopAndWait | this.StopAndWait | No description available. |
| Registry | this.Registry | No description available. |
| Environment | this.Environment | No description available. |
Operations
Parameters
| Name | Type | Description |
|---|---|---|
| options | ElmishRuntimeOptions | Host delivery and diagnostic policy. |
| environment | 'env | The environment every command runs with; it must implement IHasClock. |
Returns
Parameters
| Name | Type | Description |
|---|---|---|
| options | ElmishRuntimeOptions | Host delivery and diagnostic policy. |
| layer | Layer<'input, 'error, 'env> | The layer that builds the runtime's environment. |
| input | 'input | The input environment required to build the layer. |

