Skip to content

Commit

Permalink
Create a Browser.element app with textarea, #55
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonLab committed Dec 13, 2019
1 parent f43b139 commit 94a986c
Showing 1 changed file with 64 additions and 2 deletions.
66 changes: 64 additions & 2 deletions assets/src/Main.elm
Original file line number Diff line number Diff line change
@@ -1,5 +1,67 @@
module Main exposing (main)

import Html exposing (text)
import Browser
import Html exposing (Html, div, text, textarea)
import Html.Events exposing (onInput)

main = text "Hello Elm Capture!"

main =
Browser.element
{ init = init
, update = update
, subscriptions = subscriptions
, view = view
}



-- Model containg the capture text


type alias Model =
{ capture : String }



-- Msg


type Msg
= Capture String



-- init


initModel : Model
initModel =
{ capture = "" }


type alias Flags =
()


init : Flags -> ( Model, Cmd Msg )
init _ =
( initModel, Cmd.none )


update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
Capture text ->
( { model | capture = text }, Cmd.none )


subscriptions : Model -> Sub Msg
subscriptions _ =
Sub.none


view : Model -> Html Msg
view model =
div []
[ textarea [ onInput Capture ] []
]

0 comments on commit 94a986c

Please sign in to comment.