Logo MVUish.Avalonia

Program Module

Functions and values

Function or value Description

mapErrorHandler map program

Full Usage: mapErrorHandler map program

Parameters:
    map : (string * exn -> unit) -> string * exn -> unit
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: Program<'Arg, 'Model, 'Msg, 'View>
Type parameters: 'Arg, 'Model, 'Msg, 'View

Transform the existing error handler.

map : (string * exn -> unit) -> string * exn -> unit
program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: Program<'Arg, 'Model, 'Msg, 'View>

mapSubscription map program

Full Usage: mapSubscription map program

Parameters:
    map : ('Model -> Sub<'Msg>) -> 'Model -> Sub<'Msg>
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: Program<'Arg, 'Model, 'Msg, 'View>
Type parameters: 'Model, 'Msg, 'Arg, 'View

Transform the existing subscription function, to accumulate instead of replace.

map : ('Model -> Sub<'Msg>) -> 'Model -> Sub<'Msg>
program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: Program<'Arg, 'Model, 'Msg, 'View>

mapTermination map program

Full Usage: mapTermination map program

Parameters:
    map : ('Msg -> bool) * ('Model -> unit) -> ('Msg -> bool) * ('Model -> unit)
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: Program<'Arg, 'Model, 'Msg, 'View>
Type parameters: 'Msg, 'Model, 'Arg, 'View

Transform the existing termination criteria and handler.

map : ('Msg -> bool) * ('Model -> unit) -> ('Msg -> bool) * ('Model -> unit)
program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: Program<'Arg, 'Model, 'Msg, 'View>

mkProgram init update view

Full Usage: mkProgram init update view

Parameters:
    init : 'Arg -> 'Model * Cmd<'Msg>
    update : 'Msg -> 'Model -> 'Model * Cmd<'Msg>
    view : IObservable<'Model> -> Dispatch<'Msg> -> 'View

Returns: Program<'Arg, 'Model, 'Msg, 'View>
Type parameters: 'Arg, 'Model, 'Msg, 'View
init : 'Arg -> 'Model * Cmd<'Msg>
update : 'Msg -> 'Model -> 'Model * Cmd<'Msg>
view : IObservable<'Model> -> Dispatch<'Msg> -> 'View
Returns: Program<'Arg, 'Model, 'Msg, 'View>

mkSimple init update view

Full Usage: mkSimple init update view

Parameters:
    init : 'Arg -> 'Model
    update : 'Msg -> 'Model -> 'Model
    view : IObservable<'Model> -> Dispatch<'Msg> -> 'View

Returns: Program<'Arg, 'Model, 'Msg, 'View>
Type parameters: 'Arg, 'Model, 'Msg, 'View
init : 'Arg -> 'Model
update : 'Msg -> 'Model -> 'Model
view : IObservable<'Model> -> Dispatch<'Msg> -> 'View
Returns: Program<'Arg, 'Model, 'Msg, 'View>

onError program

Full Usage: onError program

Parameters:
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: string * exn -> unit
Type parameters: 'Arg, 'Model, 'Msg, 'View

Get the current error handler.

program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: string * exn -> unit

run program

Full Usage: run program

Parameters:
    program : Program<unit, 'Model, 'Msg, 'View>

Returns: 'View
Type parameters: 'Model, 'Msg, 'View

Start the dispatch loop with 'unit' for the init() function.

program : Program<unit, 'Model, 'Msg, 'View>
Returns: 'View

runWith arg program

Full Usage: runWith arg program

Parameters:
    arg : 'Arg
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: 'View
Type parameters: 'Arg, 'Model, 'Msg, 'View

Start the program and return the view. The program runs until its termination message arrives; to stop it externally, use runWithLifecycle and dispose the returned handle.

arg : 'Arg
program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: 'View

runWithLifecycle arg program

Full Usage: runWithLifecycle arg program

Parameters:
    arg : 'Arg
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: 'View * IDisposable
Type parameters: 'Arg, 'Model, 'Msg, 'View

Start the program and return the view plus its lifetime handle: disposing the handle stops subscriptions, completes the model stream, and stops the update loop. Disposing twice is a no-op. Prefer calling Dispose on the UI thread. Controls bound to the model stream revert to their default property values when the stream completes.

arg : 'Arg
program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: 'View * IDisposable

runWithLifetime visual arg program

Full Usage: runWithLifetime visual arg program

Parameters:
    visual : Visual
    arg : 'Arg
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: 'View * IDisposable
Type parameters: 'Arg, 'Model, 'Msg, 'View

Start the program bound to a visual's tree lifetime: the returned handle stops the program when the visual first detaches from the visual tree. Re-attaching does not restart it; run a new program instead. For visuals that detach and reattach by design (cached tabs), use runWithLifecycle and own the disposal yourself.

visual : Visual
arg : 'Arg
program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: 'View * IDisposable

withConsoleTrace program

Full Usage: withConsoleTrace program

Parameters:
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: Program<'Arg, 'Model, 'Msg, 'View>
Type parameters: 'Arg, 'Model, 'Msg, 'View

Trace all the updates to the console, including active sub ids.

program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: Program<'Arg, 'Model, 'Msg, 'View>

withErrorHandler onError program

Full Usage: withErrorHandler onError program

Parameters:
    onError : string * exn -> unit
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: Program<'Arg, 'Model, 'Msg, 'View>
Type parameters: 'Arg, 'Model, 'Msg, 'View

Handle command and update errors. Replaces any existing handler.

onError : string * exn -> unit
program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: Program<'Arg, 'Model, 'Msg, 'View>

withSubscription subscribe program

Full Usage: withSubscription subscribe program

Parameters:
    subscribe : 'Model -> Sub<'Msg>
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: Program<'Arg, 'Model, 'Msg, 'View>
Type parameters: 'Model, 'Msg, 'Arg, 'View

Register the subscription set for the program, replacing any existing one. 'subscribe' runs with every new model; the engine starts and stops subscriptions to match what it returns.

subscribe : 'Model -> Sub<'Msg>
program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: Program<'Arg, 'Model, 'Msg, 'View>

withTermination predicate onTerminate program

Full Usage: withTermination predicate onTerminate program

Parameters:
    predicate : 'Msg -> bool
    onTerminate : 'Model -> unit
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: Program<'Arg, 'Model, 'Msg, 'View>
Type parameters: 'Msg, 'Model, 'Arg, 'View

Set the exit criteria and the handler, replacing any existing termination. A message matching the predicate terminates the program: subscriptions stop, the model stream completes, and the handler runs with the final model.

predicate : 'Msg -> bool
onTerminate : 'Model -> unit
program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: Program<'Arg, 'Model, 'Msg, 'View>

withTrace trace program

Full Usage: withTrace trace program

Parameters:
    trace : 'Msg -> 'Model -> SubId list -> unit
    program : Program<'Arg, 'Model, 'Msg, 'View>

Returns: Program<'Arg, 'Model, 'Msg, 'View>
Type parameters: 'Msg, 'Model, 'Arg, 'View

Trace every update: message, resulting model, and the ids of the subscriptions the new model wants active.

trace : 'Msg -> 'Model -> SubId list -> unit
program : Program<'Arg, 'Model, 'Msg, 'View>
Returns: Program<'Arg, 'Model, 'Msg, 'View>

Type something to start searching.