I forgot to put the update function:
update msg ({cards, startTime, currentTime} as model) =
case msg of
FlipCard id message -> ({ model | cards = checkCards (updateCards
id message cards) }, Cmd.none)
Restart -> init
Tick newTime -> ({ model | currentTime = newTime }, Cmd.none)
El sábado, 18 de junio de 2016, 21:51:34 (UTC-3), Juan Martin Buireo
escribió:
>
> Thanks again for the response. The problem is the following:
>
> My model is:
> type alias Model = { cards : List IndexedCard, startTime : Time,
> currentTime : Time }
>
> And I have a subscription where I do:
> subscriptions : Model -> Sub Msg
> subscriptions model = Time.every Time.second Tick
>
> So with this, I have to questions, in the init function, how should I
> initialize startTime and currentTime? That's what I don't know
>
> El sábado, 18 de junio de 2016, 21:22:23 (UTC-3), Dan P escribió:
>>
>> Assuming there's a field in your model with the current time, I'd just
>> make a message SetStartTime which makes the update function return { model
>> | startTime = currentTime }.
>>
>
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.