I have a really expensive calculator that I need to run in my "update" function.
When it starts, the entire application is blocked until it ends.
Is there a way to run this code asynchronously to prevent blocking? (not using ports and staying in elms)
Elm Tasks do not support proactive multitasking.
With the help of, Process.spawnyou can create tasks that will be switched by context when used as arguments in Task.andThen.
Process.spawn
Task.andThen
, Task x Process.Id, , .
Task x Process.Id
Process.Id.
Process.Id
. , , :
DoHeavyStuff a b -> let task param1 param2 = Task.succeed 1 `Task.andThen` (\_ -> Task.succeed <| expensive param1 param2) in (model, Task.perform NoOp FinishedWork (task a b)) FinishedWork result -> ...
Source: https://habr.com/ru/post/1651774/More articles:https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1651769/if-then-else-dsl-define-implicits-to-distinguish-two-return-types&usg=ALkJrhjKKKWMTwI9Ycga1sHxKCDcxiEpfgWhat does it mean to sort an array / matrix using argmax as a key? - pythonHow to unit test an application for recording Android sound using robolectric - androidASP.NET MVC - Sorting forum topics by last post - asp.netHow to display apostrophe 'in messages of persons added via OmniFaces Messages # add - jsfDjango migration cannot find GDALRaster - python3D Touch, Peek & Pop with different frame sizes - iossparkSession / sparkContext cannot get hadoop configuration - hadoopHow to check a function returning a function? - javascriptInvalid support type: Chat: type "number" is not valid; it should be a function, usually from React.PropTypes - reactjsAll Articles