I have been trying something that I think could be shared.

Basically I tried to see if it was possible to throttle commands by 
controlling the event attributes in the view that generate those commands. 
Well, turns out, not really ^^. The idea was the following:

* In the model, have an attribute `active : Boolean` initialized at True 
(meaning that the event will trigger).
* In the `MoveMsg` case of update function, set `active` to False and 
create a command that will reactivate it later in some time.
* In the `Reactivate` case of update, reset `active` to True.
* In the view, use `div [on "mousemove" ...] [...]` if active else `div [] 
[...]`

This almost work (so it doesn't ^^). Since mouse events can be triggered 
more often than the rendering of the view, multiple mousemove events can be 
triggered before the `[on "mousmove" ...]` is removed.
In practice the longer the functon in your mousemove update, the higher are 
the chance that I got these multiple trigger before deactivation of the 
listener.

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