I’ve written an irclog viewer that dynamically updates when new messages appear (they are storred in CouchDB, and the elm frontend polls its _changes feed).
Looks like the relevant functions return a Task. Is that what you’re having difficulty with? You don’t say in the question but that’s a tricky aspect of Elm if for a lot of people so I’m assuming.
Tasks are a bit like Promises in JS. They allow you to do effects asynchronously. But a key difference is that they don’t execute as soon as you create them. You compose the Tasks and chain them together, then you want to actually run the effect, you turn the Tasks into a Cmd using Task.perform or Task.attempt. http://package.elm-lang.org/packages/elm-lang/core/4.0.0/Task
You need to take the returned Task and ‘attempt’ it. And you’ll need to handle the case where the target ID is not found.
I tried to create an example but I haven’t got it fully working. But it’s getting late so I’m just posting anyway, maybe it will guide you in the right direction! https://ellie-app.com/dDyjHK44La1/0
It returns a success value but doesn’t actually scroll.
You have to provide the ID of the element that you want to scroll. If the scrolling element is the body itself, you need an ID on the body so that you can target it.
It doesn’t need to be artificially limited in height, I used that so it would have a scrollbar rather than expanding in height. It requires an ID on the element you want to scroll, and a scroll bar, in that example I used a scrollable div so that it would fit on one screen.
If you put an ID on the body tag you can scroll that.