After a user logs in, I want to show a brief message, then redirect. It seems I can send an update within an update by doing this:
LogIn (Ok newUser) ->
( { model | user = newUser, showPopup = True }
, Task.perform ShowDashboard Time.now )
But how can I delay that update? I saw some code which made me belief I could write:
LogIn (Ok newUser) ->
( { model | user = newUser, showPopup = True }
, Process.sleep 5 |> Task.perform ShowDashboard Time.now )
I don’t yet know what this means (still learning Elm), but this doesn’t compile.
In JavaScript this would be done with using setTimeout(). The closest answer I could google was this: https://stackoverflow.com/questions/40599512/how-to-achieve-behavior-of-settimeout-in-elm but I couldn’t get any of the code described there to compile. Obviously my inability yet to read and write Elm highly contributes to that, so when I see things like “! [ ]” or “|>” I’m getting lost a bit :slight_smile.