On Wed, Dec 28, 2016 at 3:10 PM, GordonBGood <[email protected]> wrote:

>
> So you are saying we can already do the following:
>
> type Msg = ProgProgress Progress | ProgCancelled | ProgDone Answer | Tick
>
> port startLRP : () -> Cmd msg
>
> port cancelLRP : () -> Cmd msg
>
> subscriptions model =
>   Subs.batch
>     [ lrpProgress ProgProgress
>     , lrpCancelled ProgCancelled
>     , lrpDone ProgDone
>     , Timer.every 1000 Tick ]
>
> port lrpProgress : (Progress -> Msg) -> Sub Msg
>
> port lrpCancelled : (() -> Msg) -> Sub Msg
>
> port lrpDone : (Answer -> Msg) -> Sub Msg
>
> with the Native JavaScript as per the link for each of the ports, Types
> all defined, update function handling all Msg cases, and the subscription
> system will automatically handle getting each subscription to the right Msg?
>
> Will this not cause problems with the Timer.every subscription?
>
>
This looks like valid code to me.
I would implement it differently, in a way where the model captures the
current state of the process and the subscription uses that state to listen
only to the relevant Subs but... that's more of an optimization.

Also, I assume that Answer and Progress are aliases to types that can
travel the ports.

What kind of problems do you foresee with Timer.every?



-- 
There is NO FATE, we are the creators.
blog: http://damoc.ro/

-- 
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.

Reply via email to