Skip to content

Commit 523f2ec

Browse files
Delete all code related to counters and input signals
1 parent a27de84 commit 523f2ec

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

Main.elm

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ import Html exposing (..)
22
import Html.Attributes exposing (..)
33
import Html.Events exposing (on, onClick, onDoubleClick, onFocus, onBlur, onWithOptions, targetValue)
44
import Signal exposing (Address)
5-
import Keyboard
6-
import Mouse
7-
import Time
85
import Char exposing (isDigit)
96
import String
107
import Json.Decode as JSON exposing ((:=))
@@ -13,8 +10,7 @@ import Task exposing (Task, andThen, onError)
1310

1411

1512
type alias Model =
16-
{ counter: Int
17-
, creditCard: CreditCard
13+
{ creditCard: CreditCard
1814
}
1915

2016

@@ -28,8 +24,7 @@ type alias CreditCard =
2824

2925
initialModel : Model
3026
initialModel =
31-
{ counter = 0
32-
, creditCard = CreditCard "" "" "" ""
27+
{ creditCard = CreditCard "" "" "" ""
3328
}
3429

3530

@@ -91,19 +86,7 @@ events =
9186

9287
inputs : Signal Action
9388
inputs =
94-
let
95-
x = Signal.map .x Keyboard.arrows
96-
delta = Time.fps 30
97-
toAction n =
98-
case n of
99-
-1 -> Decrement
100-
1 -> Increment
101-
_ -> NoOp
102-
103-
arrows = Signal.sampleOn delta (Signal.map toAction x)
104-
clicks = Signal.map (always Increment) Mouse.clicks
105-
in
106-
Signal.mergeMany [actions.signal, arrows, clicks]
89+
actions.signal
10790

10891

10992
main : Signal Html
@@ -117,11 +100,7 @@ main =
117100
view : ViewState -> Model -> Html
118101
view state model =
119102
div []
120-
[
121-
--button [ onClick address Decrement ] [ text "-" ]
122-
--, div [] [ text (toString model.counter) ]
123-
--, button [ onClick address Increment ] [ text "+" ]
124-
(activeView state.activeView) state model
103+
[ (activeView state.activeView) state model
125104
, debugView state model
126105
]
127106

@@ -438,17 +417,13 @@ cardExpirationDate state =
438417

439418
type Action
440419
= NoOp
441-
| Increment
442-
| Decrement
443420
| CardSubmitted CreditCard
444421

445422

446423
update : Action -> Model -> Model
447424
update action model =
448425
case action of
449426
NoOp -> model
450-
Increment -> { model | counter = model.counter + 1 }
451-
Decrement -> { model | counter = model.counter - 1 }
452427
CardSubmitted newCard -> { model | creditCard = newCard }
453428

454429

0 commit comments

Comments
 (0)