I
Size: a a a
I
R:
AK
AK
AK
AK
ort module Main exposing (..)
import Html exposing (Html, p, program, text)
import Json.Decode exposing (..)
-- MAIN
main =
program
{ init = init
, update = update
, view = view
, subscriptions = subscriptions
}
-- MODEL
type alias Model =
String
init : ( Model, Cmd Msg )
init =
( "", Cmd.none )
-- UPDATE
type Msg
= UpdateModel (Result String String)
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
UpdateModel new ->
( "blop", Cmd.none )
-- SUBSCRIPTIONS
decoder : Decoder String
decoder =
string
port bleep : (Value -> msg) -> Sub msg
subscriptions : Model -> Sub Msg
subscriptions _ =
bleep (decodeValue decoder >> UpdateModel)
-- VIEW
view : Model -> Html Msg
view model =
text <| toString model
AK
<html>
<head>
<style>
html {
background: #F7F7F7;
}
</style>
</head>
<body>
<script>
var app = Elm.Main.fullscreen();
window.foo = function(a) {
app.ports.bleep.send(a);
}
</script>
</body>
</html>
AK
R:
AK
AK
R:
AK
R:
AK
AK
AK
R: