The Defer module provides a component following The Elm Architecture that defers one or more commands to run after the next browser animation frame.
See the example directory for a program that uses the Defer module in this way.
It's nearly a minimal example; searching for "Defer" in it shows how a
component is to be wired into another program.
(The necessary component wiring code is about as big as the Defer module itself. If that's an issue the Defer code could be used as a basis for doing similar logic inline in the program.)