要在0.17中熟悉subscriptions
,我试图获得一个订阅Mouse.clicks的简单应用,并将Model
增加一个。
目前该应用有以下投诉。
函数program
期望参数为:
{ ...
, subscriptions : Float -> Sub Msg
, update : Msg -> Float -> ( Float, Cmd Msg )
, view : Float -> Html Msg
}
但它是:
{ ...
, subscriptions : (Msg -> Position -> a) -> Sub a
, update : Msg -> number -> ( number, Cmd b )
, view : c -> Html d
}
非常感谢任何帮助。
import Html exposing (Html, text, div)
import Html.App as Html
import Mouse exposing (..)
main =
Html.program
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
}
-- MODEL
type alias Model = Int
init : (Model, Cmd Msg)
init =
(0, Cmd.none)
-- UPDATE
type Msg
= Click
update msg model =
case msg of
Click ->
(model + 1 , Cmd.none)
-- SUBSCRIPTIONS
subscriptions model =
Mouse.clicks (model Click)
-- VIEW
view model =
Html.text (toString model)
答案 0 :(得分:1)
问题出在您的# logrotate --version
logrotate 3.8.6
功能中。你需要像这样设置它:
subscriptions