Greetings,
can somebody explain how to use Process.sleep in elm 0.19?
I’ve found example for elm 0.18, but now it deprecated.
Thanks a lot.
Greetings,
can somebody explain how to use Process.sleep in elm 0.19?
I’ve found example for elm 0.18, but now it deprecated.
Thanks a lot.
Looks like it works the same in 0.19? I’m not seeing any signs of it being deprecated https://package.elm-lang.org/packages/elm/core/latest/Process#sleep
Hi!
Could you describe more what you want to achieve? It’s easier to explain how to do a specific thing than to write a full documentation on how something works.
Hi,
I’m trying to apply style on div element with some delay.
Simple case:
Here’s the example code https://ellie-app.com/39LXS5pzJkJa1
P.S I found that Elm doesn’t update the view in the case below:
update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
case msg of
ChangeStyle ->
( { model | color = "red" } -- this doesn't change the view!
, Task.perform ChangeStyleSet (Task.succeed "green") -- but this does
)
ChangeStyleSet color ->
( { model | color = color }
, Cmd.none
)
So I decided to add a little bit delay to update style on the DOM element.
Actually I needed it for quickly update style on textarea on height attribute from pixels to “auto” for normalize height.
Ok, I see what you want to do, here is how you can do it:
Process.sleep 100 |> Task.perform (always (ChangeStyleSet "green"))
Thanks, I’ve tried it and it works!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.