Skip to content

Instantly share code, notes, and snippets.

@ohanhi
Created July 21, 2018 08:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohanhi/fb6546263965da956f6bfce8f78349e7 to your computer and use it in GitHub Desktop.
Save ohanhi/fb6546263965da956f6bfce8f78349e7 to your computer and use it in GitHub Desktop.
elm make Flags.elm --output=elm.js
module Flags exposing (..)
import Browser
import Browser.Navigation
import Html exposing (p, text)
import Url
main : Program Int Int Msg
main =
Browser.application
{ init = init
, view = view
, update = update
, subscriptions = \_ -> Sub.none
, onUrlRequest = \_ -> NoOp
, onUrlChange = \_ -> NoOp
}
init : Int -> Url.Url -> Browser.Navigation.Key -> ( Int, Cmd Msg )
init flags url key =
( flags, Cmd.none )
view : Int -> Browser.Document msg
view model =
Browser.Document "Hi" [ p [] [ text (String.fromInt model) ] ]
update : Msg -> Int -> ( Int, Cmd Msg )
update msg model =
( model, Cmd.none )
type Msg
= NoOp
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>Flags test</title>
<script src="elm.js"></script>
</head>
<body id="page-body">
<script>
Elm.Flags.init(20);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment