I can think of two path to update the current time:
- through subscription to Time.every, set duration like 1 min
- through update command like:
update msg mode =
case msg of
OtherAction ->
...
{ model | ... } ! [ Task.perform (\_ -> NoOp) UpdateTime
Time.now ]
UpdateTime time ->
{ model | currentTime time } ! []
NoOp ->
model ! []
On Fri, Sep 30, 2016 at 2:24 PM, Max Goldstein <[email protected]>
wrote:
> I think there are two parts here.
>
> A "time ago in words" library as a pure function of two dates (now and the
> date in question). This is independent of where the dates come from.
>
> A subscription that provides you the "now" date at a frequency you
> specify, which gets stored in the model. I don't think there's a way to ask
> for the date only when *update* would otherwise be called, and you don't
> want that (the time should update if the user leaves the computer alone for
> ten minutes).
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Elm Discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/elm-discuss/G32oBI6yAxw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
Best Regards,
Jacky See
--
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.