[elm-discuss] Re: Scrolling to bottom of div

2016-07-19 Thread Simon
the alternative is to use a `Tick` or `Time.now` such that a command returns immediately and allows you to run the port command in the first possible cycle after the virtual DOM has been rendered On Tuesday, 19 July 2016 22:28:01 UTC+2, Wayne Choi wrote: > > I guess it's a small price to pay. >

[elm-discuss] Re: Scrolling to bottom of div

2016-07-19 Thread Wayne Choi
I guess it's a small price to pay. On Tuesday, July 19, 2016 at 12:42:25 PM UTC-7, Frederick Yankowski wrote: > > It's just a heuristic that someone came up with. It's short enough to be > almost imperceptible but long enough that the updated element should be > settled in the browser. > > On T

[elm-discuss] Re: Scrolling to bottom of div

2016-07-19 Thread Frederick Yankowski
It's just a heuristic that someone came up with. It's short enough to be almost imperceptible but long enough that the updated element should be settled in the browser. On Tuesday, July 19, 2016 at 1:02:59 PM UTC-5, Wayne Choi wrote: > > Thanks, Frederick.. is there a reason something special ab

[elm-discuss] Re: Scrolling to bottom of div

2016-07-19 Thread Wayne Choi
Thanks, Frederick.. is there a reason something special about 50? On Tuesday, July 19, 2016 at 9:29:31 AM UTC-7, Frederick Yankowski wrote: > > To avoid the race condition you can either add setTimeout(..., 50) on the > JS side or use AnimationFrame.times on the Elm side to wait for the next >

[elm-discuss] Re: Scrolling to bottom of div

2016-07-19 Thread Frederick Yankowski
To avoid the race condition you can either add setTimeout(..., 50) on the JS side or use AnimationFrame.times on the Elm side to wait for the next frame before running your port command. The fredcy/elm-defer-command packa

[elm-discuss] Re: Scrolling to bottom of div

2016-07-19 Thread Wayne Choi
Thanks, I ended up using a port and scrollIntoView. However, it seems as there's a race condition where the command gets sent to the port before the dom has rendered resulting in a "div not found" error. Is there a way to fire off messages only after a dom has finished rendering. Right now, I'm

[elm-discuss] Re: Scrolling to bottom of div

2016-07-19 Thread Ian Mackenzie
There isn't yet a pure-Elm way to do it, but there's a bunch of discussion going on right now about adding setScrollTop and similar functions (see https://groups.google.com/forum/#!topic/elm-dev/ThkWudq7SF0). In the meantime the answer is likely 'use ports'. On Tuesday, 19 July 2016 09:27:58 UT