Permalink
Browse files

use StartApp package

  • Loading branch information...
maxhoffmann committed Jan 24, 2016
1 parent 354b891 commit bc8aced46653bd51e86c1e9c61847b8ff5ba354d
Showing with 68 additions and 2 deletions.
  1. +42 −0 App.elm
  2. +26 −2 Main.elm
42 App.elm
@@ -0,0 +1,42 @@
module App where
import Signal exposing (..)
import Html exposing (..)
import Effects exposing (Effects, Never)
-- MODEL
type alias Model =
{
ip: String
}
init : (Model, Effects Action)
init =
(
{
ip = "Unknown"
},
Effects.none
)
--- UPDATE
type Action
= DoNothing
update: Action -> Model -> (Model, Effects Action)
update action model =
case action of
DoNothing ->
(model, Effects.none)
-- VIEW
view : Address Action -> Model -> Html
view address model =
div [] [
button [] [ text "Get IP address" ],
div [] [ text model.ip ]
]
@@ -1,6 +1,30 @@
module Main where
import Html exposing (text)
import StartApp
import Task
import Effects exposing (Effects, Never)
import Html exposing (Html)
import App exposing (init, update, view, Model)
--- SETUP
app : StartApp.App Model
app =
StartApp.start
{
init = init,
view = view,
update = update,
inputs = []
}
main : Signal Html
main =
text "Hello World"
app.html
--- PORTS
port tasks : Signal (Task.Task Never ())
port tasks =
app.tasks

0 comments on commit bc8aced

Please sign in to comment.