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.
program : { init : ( model, Platform.Cmd.Cmd msg ), update : msg -> model -> ( model, Platform.Cmd.Cmd msg ), subscriptions : model -> Platform.Sub.Sub msg, view : model -> Browser.Document msg, persistence : Maybe (JsonMapping.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.)Platform.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 { ... }
Testable.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.
Testable.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.