@@ -2,9 +2,6 @@ import Html exposing (..)
2
2
import Html.Attributes exposing (..)
3
3
import Html.Events exposing (on , onClick , onDoubleClick , onFocus , onBlur , onWithOptions , targetValue )
4
4
import Signal exposing (Address )
5
- import Keyboard
6
- import Mouse
7
- import Time
8
5
import Char exposing (isDigit )
9
6
import String
10
7
import Json.Decode as JSON exposing ((:=) )
@@ -13,8 +10,7 @@ import Task exposing (Task, andThen, onError)
13
10
14
11
15
12
type alias Model =
16
- { counter: Int
17
- , creditCard: CreditCard
13
+ { creditCard: CreditCard
18
14
}
19
15
20
16
@@ -28,8 +24,7 @@ type alias CreditCard =
28
24
29
25
initialModel : Model
30
26
initialModel =
31
- { counter = 0
32
- , creditCard = CreditCard " " " " " " " "
27
+ { creditCard = CreditCard " " " " " " " "
33
28
}
34
29
35
30
@@ -91,19 +86,7 @@ events =
91
86
92
87
inputs : Signal Action
93
88
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
107
90
108
91
109
92
main : Signal Html
@@ -117,11 +100,7 @@ main =
117
100
view : ViewState -> Model -> Html
118
101
view state model =
119
102
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
125
104
, debugView state model
126
105
]
127
106
@@ -438,17 +417,13 @@ cardExpirationDate state =
438
417
439
418
type Action
440
419
= NoOp
441
- | Increment
442
- | Decrement
443
420
| CardSubmitted CreditCard
444
421
445
422
446
423
update : Action -> Model -> Model
447
424
update action model =
448
425
case action of
449
426
NoOp -> model
450
- Increment -> { model | counter = model. counter + 1 }
451
- Decrement -> { model | counter = model. counter - 1 }
452
427
CardSubmitted newCard -> { model | creditCard = newCard }
453
428
454
429
0 commit comments