avh4/elm-desktop-app/1.0.0

DesktopApp

This module lets you write desktop applications (for Mac, Linux, and Windows) in Elm. You must use the elm-desktop-app command line tool to build your program. (DesktopApp.program will do nothing if you try to use it in a web browser.)

See the README for an example of how to set up and build your application.

{ init : ( model, Cmd msg )
, update : msg -> model -> ( model, Cmd msg )
, subscriptions : model -> Sub msg
, view : model -> Document msg
, persistence : Maybe (ObjectMapping model msg)
}
-> Program model msg

Use this to define your main in your Main.elm file, and then use the elm-desktop-app command line tool to build your app.

  • init, update, subscription, view: These are the same as in any Elm program.
  • persistence: This specifies how the data for you app will be saved to the user's filesystem. (If Nothing, then you app will not persist any data.)
type alias Program model msg =
Program () (Model model) (Msg msg)

This is the type for your Elm program when using DesktopApp.program

For example:

module Main exposing (main)


import DesktopApp


type alias Model = { ... }
type Msg = ...


main : DesktopApp.Program Model Msg
main =
    DesktopApp.program { ... }
type alias Model yourModel =
Model yourModel

This is the Model type for your Elm program when using DesktopApp.program.

Normally you won't need to refer to this directly -- use Program instead.

type alias Msg yourMsg =
Msg yourMsg

This is the Msg type for your Elm program when using DesktopApp.program.

Normally you won't need to refer to this directly -- use Program instead.