You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Elm Discuss
Hi!
I need to schedule a task to be executed after a second but I can't really find a suitable function.
There is Time.now but I need Time.now + 1 second. There is also Time.every but I need the task to be triggered only once and only starting from some user action (e.g. clicking a button).
I guess I could use ports and subscribe for an action to be responded on the Javascript side using setTimeout()... but it just feels so awkward. Isn't there anything like "Time.after : Time -> Task x msg" existing?
BR Nikolai
Max Goldstein
unread,
Aug 1, 2016, 5:28:41 PM8/1/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Elm Discuss
Process.sleep (1*Time.second)
Then use Task.andThen to perform your task.
Nikolai Koudelia
unread,
Aug 2, 2016, 4:25:19 PM8/2/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
Didn't figure out to search for it under Process because I somehow expected that module to contain process-related stuff (which it does too - spawn, kill). Also "sleep" as a name for such a function doesn't feel right because traditionally sleep blocks current thread which Elm's Process.sleep doesn't do but returns a Task instead.