What you can do is emit the commands in two batches. The first sends the
time critical operation(s) and sends a trigger message back to send the
second batch of commands. Note that you can use Cmd.batch to send multiple
commands on the delayed path:
type Msg =
Later (Cmd Msg)
update : Msg -> model -> ( model, Cmd Msg )
update msg model =
case msg of
Later cmd -> ( model, cmd )
later : Cmd Msg -> Cmd Msg
later cmd =
Task.succeed cmd
|> Task.perform Later
Mark
On Fri, May 12, 2017 at 2:50 PM, 'Rupert Smith' via Elm Discuss <
[email protected]> wrote:
> On Friday, May 12, 2017 at 4:53:19 PM UTC+1, Peter Damoc wrote:
>>
>> The execution of a Cmd.batch list of commands has not ordering guarantee.
>>
>
> I suspect that whilst there is no ordering guarantee given, the actual
> implementation probably does a 'foldr' executing them in reverse order.
> This behavior seems very consistent.
>
> In theory they could be executed in parallel and non-deterministically. In
> reality its javascript on the browser, which is single threaded, so there
> is no concurrency.
>
> --
> 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.
>
--
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.