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 > frame before running your port command. > > The fredcy/elm-defer-command > <http://package.elm-lang.org/packages/fredcy/elm-defer-command/1.0.0/> > package provides the second solution as a TEA component. > > On Tuesday, July 19, 2016 at 11:22:28 AM UTC-5, Wayne Choi wrote: > > 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 >> using a timeout in javascript but it's hacky. >> >> On Tuesday, July 19, 2016 at 12:27:33 AM UTC-7, Ian Mackenzie wrote: >>> >>> 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 UTC+10, Wayne Choi wrote: >>>> >>>> I want to scroll down to the bottom of a div for, what else, a chat >>>> app. Right now I'm using element.scrollTop = element.scrollHeight and it >>>> works fine with just javascript and html. Once I port the div to Elm, >>>> however, the function doesn't scroll all the way down. Am I missing >>>> something with how javascript interacts with the virtual dom? Is there an >>>> alternative solution? >>>> >>> >
-- 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.
