Created
July 21, 2018 08:10
-
-
Save ohanhi/fb6546263965da956f6bfce8f78349e7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elm make Flags.elm --output=elm.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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