This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
Defer commands to run after next animation frame
version 1.0.1
license BSD3
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.1
Committed At 2016-11-14 15:42:40 UTC
elm-lang/core 5.0.0 <= v < 6.0.0 5.1.1
elm-lang/animation-frame 1.0.1 <= v < 2.0.0 1.0.1




The Defer module provides a component following The Elm Architecture that defers one or more commands to run after the next browser animation frame.

This is useful such as when setting focus on a newly created element. By deferring a command this way we can be sure that the element is mounted in the browser's DOM and can be found and manipulated by javascript code triggered by commands sent over a port.

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 Defer 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.)